Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2008
Offline Last Active Today, 01:42 AM

#5291262 Clarification about shaders and Directx11

Posted by NightCreature83 on 12 May 2016 - 03:29 AM

Maybe the driver is injecting the FF emulation shaders that it puts in for any D3D9 call, that would bind a VS at least that could just be a pass through shader seeing no MVP is set either. Which then would mean that as long as you keep the vertex coordinates in screen view you will see the triangle on screen. This would off course only work with a driver that still has support for D3D9.


This is all speculation of course.


Have you tried doing a VS graphics/Renderdoc/Intel Graphics analyser/NSight capture to see what the GPU is actually doing?

#5278324 How to find the cause of framedrops

Posted by NightCreature83 on 26 February 2016 - 11:15 AM

You can use Renderdoc, INtel GPA, AMD codeXL or NVidia Nsight for GPU profiling. They all give you GPU timings, some will give you more info than others depending on the hardware you run it on. Renderdoc doesnt do DX9 though although I never checked this.

#5276543 They called me crazy!

Posted by NightCreature83 on 18 February 2016 - 09:47 AM

But does it support FILE_NOT_FOUND?

I believe boosts tribool still does this wrong as well, by not defining the third states value.

#5276141 DXGI format question.

Posted by NightCreature83 on 17 February 2016 - 10:23 AM

Beware though that clears in D3D11 don't respect the write mask.


Thats why you dont clear in this case, most of the games I work on that have shipped dont use clears if they dont have to. So if your SSAO target will cover the whole RTV dont clear it.

#5275248 Lumberyard Engine; Building a VS Solution File

Posted by NightCreature83 on 11 February 2016 - 04:02 AM

This should tell you how to do this: https://s3.amazonaws.com/gamedev-tutorials/Tutorials/Programming-Basics-%2801%29_Setting_up_your_development_environment_v1.pdf

#5274825 Constructor + putting into an array

Posted by NightCreature83 on 08 February 2016 - 03:28 AM

The non C++11 way is to stick the code in the constructor instead of the initialiser list, no need for 6 extra vars in that case either.

#5272017 Unique ID per type

Posted by NightCreature83 on 20 January 2016 - 09:21 AM


That should work (except there is no such thing as raw_name in std::type_info, it's just name).


A few notes:

  • As it stands, your approach will generally "work fine" but the program is ill-formed because you don't include <typeinfo> prior to evaluating a typeid expression (your compiler should warn about that?).
  • You are caching the hash in a static variable. Keep it that way. The temptation exists to instead make the hash function constexpr. Don't do that because it will not work on the stricter compilers as the name is not a constant expression (it sure is, how could it possibly not be... but the standard and the compiler think differently) and will be vastly inferior on the more forgiving compilers (which will compile fine, but evaluate at runtime).
  • std::type_info has a member function hash_code which just looks like what you want, only better, faster, and standard. Yeah right. Don't fall for that. The hash provided by the standard not only isn't portable (that would be quite hard to do, admittedly), but it does not even guarantee that the value stays the same between different runs of the same executable. Which, frankly, is total shit.
  • The standard also provides std::type_index, which suggests by its name and its description that it could be very useful (index? as in unique number? great!), but it is really just a wrapper around std::type_info which adds operators <= and >= in terms of std::type_info.before(). Other than for using it as key in unordered standard containers, it's pretty useless.
  • Instead of using std::type_info.name(), you could use the well-known hack with a helper class that contains a static function which evaluates some flavour of __func__ or __PRETTY_FUNCTION__ or whatever you want to use, optionally adding an offset into the string constant to strip off the ugly mangling. These string constants are not constexpr either (although I think they should be, unless the name of a type can change during a program's execution which would be a big WTF, they are pretty darn constant expressions), but it is less bloat than using std::type_info (especially with GCC which has a very poor implementation), and you save yourself from including another header. I seem to remember someone even posted a complete, usable implementation of the __func__ hack on this site not long ago.
  • From the most pedantic point of view, using the __func__ hack even makes your program a little more robust. The typeid operator does not guarantee that the same type_info object is returned for different invocations in the same program with the same type. This sounds like something you could take for granted, and this is probably what happens anyway, but in the strictest sense, that's not the case. The standard merely says that some type_info (or derived) object with static storage duration is returned (and leaving unspecified whether destructors are called), and that the objects from different typeid expressions with the same type compare equal. That doesn't mean that they are equal, or that that name() returns the same value (or even the same pointer).


I wouldnt use type info for this, you can do this through the preprocessor with something like:

//create a hash based of a type name
inline uint64_t HashTypeName(const char* str)
  //djb2 algorithm from here:
  uint64_t hash = 5381;
  int c;
  while((c = *str++) != 0)
    hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
  return hash;
#define HASHTYPE(type)\
    inline TypeHash HashType()\
      //a way of generating a hash that is cross platform\
      static TypeHash hash = HashTypeName(#type);\
      return hash;\
Class MyType

This needs less template magic than your solution and is generally easier to use because typeid names contain namespaces and such which can make it hard to figure out what a hash belongs too when you are debugging the code. In my case you can just run the HashTypeName("MyType") function in the watch window to find the hash of your type when on a breakpoint.


Alot of game engines have stuff like Runtime type info turned off in compile settings which will make typeid not work for dynamic types.


If you use a constexpr hash function all of the preprocessor stuff and dynamic lookup of typeid at runtime will be change to static compile time implementations.

#5271814 C++

Posted by NightCreature83 on 19 January 2016 - 03:18 AM

http://www.amazon.com/A-Tour-C-In-Depth/dp/0321958314 this is Bjarnes new book on C++ and its more written for people who can already program as in construct an algorithm and just want to pick up C++ as a language.

Scott Meyers books are also good to learn C++ but again these assume you can already program and want to know more about C++ under the hood.

#5270517 Injection LPV Geometry Shader

Posted by NightCreature83 on 11 January 2016 - 06:19 AM


Use RenderDoc. It will provide a lot of help in debugging your problem.


Normally your errors means the structure definition between the VS & GS and the GS & PS do not match. It doesn't seem to be the case here, although I never worked with GS that involved points instead of tris.

This error can also happen if you later render something else, and you changed the VS & PS but forgot to take out the GS (very common mistake).


You're also getting errors that your pixel shader is using MRT and outputting to 3 RTs; but you never call OMSetRenderTargets with three different RTs. It looks like you're confusing PSSetShaderResources with OMSetRenderTargets.


And last but not least. Use RenderDoc. It's an invaluable tool which will help you understand what's going wrong.


thank you for your guide

i've used OMSetRenderTargets at the first line of my function.



This error can also happen if you later render something else, and you changed the VS & PS but forgot to take out the GS (very common mistake).


this was an issue !

i also didn't set 3 global variables in my geometry shader thanks to RenderDoc

but still has some issue, i'll let you know if it doesn't solve.


thanks btw


Update : another issue was i didn't return back the primitive topology to TriangleList

this RenderDoc is very useful tool but i have to gain more experience of how to use it and which parts are more important to look at when i facing on any errors.


everything looks fine now, i have to go for propagation step and see the result !


RenderDoc works pretty similar to a normal debugger for C++ code, except that in GPU land you have a few more things to worry about, like pipeline states and stuff like that. A very usefull overlay in the render target view is "Wireframe mesh" this will instantly show you where and whether a draw call hit the render target. Edit from there you usually start with debug pixel in that wire frame overlay so you can see what happens to it, this will also id most of the resources used so you can inspect them.

#5264231 as3 need link for tuturial from scrap

Posted by NightCreature83 on 30 November 2015 - 09:08 AM

Hi everyone. I will try to soften you first because i sure that you will answer to my question in rude way, stating that i just don't know how to search google. Ok, so first i must admit that right now i'm in fury(as i can't find what i want). I like to start learning something from scrap to fully understand concept. Like for exsample learning all 3 possibilities of declarating types in c++ or unique tricks like java ToString function. just knowing primal features is not for me, i must know like 99% of everything about programing language to use it as best as i can. I hope that you understood my policy of learning. Now here comes question/asking for favor : i need some very good tuturials for pure as3 language , from scientific way. I mean most what i found was just ""make image, handle event,make game , make game, make game .... bla bla bla"". I dont want to know how function to make rectangle is works(because it obvious), i want to know how it build so in future i can use this knowledge for making own more advance version of drawing rectangle. I want a long tuturial there most of important functions/data types/classes described accurately.


Flash is not really a langauge in its own, you can do most things in AS but that is not how you should use flash. Flash is more of a designer/artists tool to create animated pages in. This is also why most tutorials only show the graphical side of what you are doing. As3 for me is nothing more than a weird mix between C# and Python, as such writing code in it is not that hard when you know C++.


Generally I just use the adobe documentation sites to figure out what a particular class does in Flash, and which methods it has.

After having learned 2 languages I no longer care for knowing all the obscure things in a langauge as long as I know how to express what I want to do.

#5263528 Render GUI elements with projection matrix

Posted by NightCreature83 on 25 November 2015 - 02:59 AM

That depends on what you want to do, usually you have an overlay 2D ui to do things like error message boxes or HUD elements but these are 2D ui and are a different scene from the 3D ui one. And they just use normal ortho projection rendering.


Offcourse you can embed rendertargets into the 3D scene to render another UI scene to that, but even for that you dont need to know things about pixels for positioning the elements.

#5263526 Visual Studio Community need to login!

Posted by NightCreature83 on 25 November 2015 - 02:56 AM

The login part has its advantages. 


Vs2015 will save various preferences to your profile, and if you reinstall they'll all be fetched from "the cloud" for you.


A worthwhile sacrifice for the service as setting up programs again how I like them is an annoying chore that I'd rather avoid...


There are other things linked to it as well, like your developer status for store apps and beta apis that you can use.

#5263432 Render GUI elements with projection matrix

Posted by NightCreature83 on 24 November 2015 - 11:56 AM

Thanks to all for your answers. 


What do you think about using PerspectiveOffCenterLH matrix for this?

Seems it project DirectX units directly to pixels and position correspondingly. Using this matrix 0.0 will be at the top left corner of the window without any additional manipulations.

Step away from the pixel idea for 3D ui pixels dont really matter, the scene is authored in 3D space and its coordinate system. Think in camera composition instead, moving the camera closer to an object will make it appear bigger on screen.

#5263321 Render GUI elements with projection matrix

Posted by NightCreature83 on 23 November 2015 - 02:22 PM

I mean that I want to draw controls using true depth feeling, which could be made only with projection matrix. With ortho I need to scale objects manually if I want make them smaller when they are far from the camera.

You will want to just do normal 3D rendering and use a camera to view the menu through. Use this camera idea to frame the UI too it makes it a lot easier to deal with.


In a 3D ui you dont have to care about the 0,0,0 mapping on to the 0,0 corner, this is what the frameing with a camera is for.


If you look at the DiRT and GRID games they all have a 3D ui, and for ease of development we never supported mouse input all input is either keyboard arrows and enter or controller. Doing the unprojection is not that hard but the system we had to create these UIs made that a lot harder, the update side of the UI had no idea of where the rendering of the UI was happening in space. Which allowed for a lot of flexibility in setting up scenes and implementing the behaviour of the screens at the cost of not having mouse input though.

#5262753 No idea about this warning in VS2015

Posted by NightCreature83 on 19 November 2015 - 10:25 AM

By upgrading to the latest SDK