Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2008
Offline Last Active Yesterday, 06:24 AM

#5301201 D3D11 - Bitmap Font Rendering

Posted by on 18 July 2016 - 07:28 AM

Do you create a buffer for each quad or are you using a buffer to hold multiple quads? (the text you wrote to me indicates that you create a buffer for each quad so just want to clear that up)


You should discard the content of the old buffer when you are filling it again with new data, you could create a quad data that contains all of the transformed vertex data and then just copy that into the vertex buffer for rendering. You would need a new VB if you change font or scaling size offcourse, and even that is fixable with instanced rendering.

#5294361 Selecting the actual GPU

Posted by on 31 May 2016 - 02:28 PM

This is the info I get from DXGI on Windows 10

[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(105) : 0
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(110) : vendor id: 8086
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(111) : device id: 416
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(112) : subsytem id: 11021462
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(113) : revision: 6
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(114) : Dedicated VRAM: 112 MiB
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(115) : Dedicated RAM: 0 MiB
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(116) : Shared RAM: 8150 MiB
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(119) : description: Intel(R) HD Graphics 4600
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(105) : 1
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(110) : vendor id: 10de
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(111) : device id: 13d8
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(112) : subsytem id: 11021462
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(113) : revision: 161
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(114) : Dedicated VRAM: 2991 MiB
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(115) : Dedicated RAM: 0 MiB
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(116) : Shared RAM: 8150 MiB
[RENDER SYSTEM ADAPTER INFO:] : ..\..\Graphics\RenderSystem.cpp(119) : description: NVIDIA GeForce GTX 970M

If you set the preffered adapter to be NVidia in the control panel of the driver than DXGI will report that adapter first.

#5294341 Selecting the actual GPU

Posted by on 31 May 2016 - 12:21 PM

What Oberon_Command mentions seems to be the issue once I used the GetClientRect and used does values all started working again and it actually selects the NV chip as the one to render on, thanks for that :)


It also makes it so you can just use DXGI to select your render device, no need to deal with the extern variables like further up in the thread :).

#5291262 Clarification about shaders and Directx11

Posted by 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 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 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 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 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 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 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 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 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 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 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 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.