Jump to content

  • Log In with Google      Sign In   
  • Create Account

Jason Z

Member Since 04 Feb 2004
Offline Last Active Yesterday, 04:26 PM

#5199803 Render Text

Posted by Jason Z on 23 December 2014 - 10:31 PM

Do you have access to the Graphics Debugger in Visual Studio?  If so, please take a frame analysis and look through the sequence of operations that have been performed.  This will likely show you why your frame ended up all white - just be sure to follow the operations and it should become more clear as you go.

#5199400 Can't Load Textures

Posted by Jason Z on 21 December 2014 - 07:33 AM

I doubt anyone is going to dig into your whole project and debug the issue for you.  Generally speaking, when you are asking for help you should let us know what you have already checked.  Is there return codes for the function you are using?  Did you step through the function call and see what is going on inside?  Have you used the graphics debugger to see what is happening from the API point of view?  These are all things you can try for yourself, and then if you still can't find an answer you can post here and tell us what you see.


I don't mean to come off as harsh - but honestly I hope you try to solve the issue on your own before posting.  You will learn much faster, and will need to post questions less frequently.  If you really do get stuck, the forums are always here to help you out...

#5199351 What is faster cbuffer or data textures for MVP matrices?

Posted by Jason Z on 20 December 2014 - 08:47 PM

It seems like you have a very specific use case in mind - why don't you try out the three methods and time them to see which one is fastest?


The truth is that you will get different answers depending on what else is going on in your game, but trying things out for yourself is always better than relying on what responses you will get here.  There is a big difference in performance depending on the size and shape of your geometry, which GPU you have, and how well your CPU side code is organized.  Profile it, and you will certainly learn something about your code and the methods you are trying to characterize!

#5196880 Create Geometry Shader with Stream Output

Posted by Jason Z on 07 December 2014 - 06:45 PM

Thank you for your replies.


Did you create your device with the D3D11_CREATE_DEVICE_DEBUG flag enabled? If you do that, you'll get error messages in the debugger output telling you why API calls failed.


I create the device without that flag, I'll try to put it in and see if there will be error messages.




The geometry shader is compiling, but the "CreateGeometryShaderWithStreamOutput" call will give me a null geometryShader value.


This is an indicator that your GS code is valid but the actual GS bytecode created by compilation won't run on your hardware (compilation doesn't do hardware validation, creation does).  I see that you're compiling with "gs_5_0" so the first thing you should check is that your hardware actually supports shader model 5.



I'm running the program with a geforce gtx 860m, which fully supports shaders v. 5!

Which feature level did you create your device with?  Even if your hardware is capable, you can easily request a lower feature level and cap yourself regarding shader level!

#5196879 How can I get started with the Hieroglyph3 framework?

Posted by Jason Z on 07 December 2014 - 06:43 PM

That usually means that the Lua project built fine (since it has zero dependencies) and that the Hieroglyph3 library failed, causing all the applications to fail too.  The issue is likely due to the fact that you are using VS2013, and the nuget package is installed for 2012.  If you uninstall the NuGet package for VS2012 from the package manager, and then install the VS2013 version, it should probably work out for you.


I am in the process of updating to VS2013, so it shouldn't be too long before I do this update and push it to the repo.

#5196633 How can I get started with the Hieroglyph3 framework?

Posted by Jason Z on 06 December 2014 - 09:59 AM

Thank you for your interest in the book and framework - sorry it took a while for me to see this thread...  If you are using VS2012, all of the pre-requisites should already be installed and ready to run.  The NuGet package for DirectXTK should automatically download, or if you disabled automatic downloads you should be prompted about downloading it.


Regarding the older versions of the framework, there is information in the documentation about what commit level was released with the book.  However, the book samples focus on the GPU side of the samples, so you can safely use the latest version and follow along just fine.  This was done intentionally, so that the CPU side could evolve over time while still keeping the samples relevant.


When you have questions like this, it could be faster to post them in the Hieroglyph discussions forum.  There have been a few other questions like this as well, so you might be able to find an answer right away too.  (plus I get email notifications of new discussions, so I will see your post right away...)


EDIT: you don't have to modify any of the settings for linking or includes - all of those should already be set up relative to the project folder.  Just open the Hieroglyph3_Desktop.sln file, rebuild all, and it should take off on its own.  Also be sure to set the desired project as the startup project (which you can do by right clicking it and choosing "Set As Startup Project").

#5195908 Alpha blending

Posted by Jason Z on 02 December 2014 - 12:13 PM

The main reason that alpha blending is slower is due to the fact that you aren't just writing memory - you first have to read the existing pixel values, perform the blend operation, and then write again.  So you are increasing the per-pixel operations performed, and you are significantly increasing the bandwidth being consumed.


Is it possible for you to do the blending in the pixel shader instead of in the blend unit?  I wouldn't be afraid to experiment a little and see if you can do something better, but just don't get sidetracked into searching for 0.5 ms time improvement until it becomes apparent that you need that time!

#5195815 Should I keep a dev/programming journal?

Posted by Jason Z on 01 December 2014 - 08:00 PM

I actually do both - I keep a daily written journal for sketching and working out problems, and then I keep a journal here on Gamedev.net to put more polished ideas and progress updates out there.  As the others have mentioned, it is motivating to some degree, and in general I find it beneficial to get other people's inputs on your work.


I have also found that the number of comments varies quite a bit, but if you put in the effort to post good content, people will be viewing it for sure.

#5195813 how to create gui buttons with DirectX 11?

Posted by Jason Z on 01 December 2014 - 07:56 PM

Yeh i understand you render 2 triangles to make a quad, but can you just specify screencoords for the vertexbuffer and it will understand the vertices are pretransform through the pipeline?

You can do that, but like unbird says, you need a vertex shader no matter what.  You can make your vertex shader just pass through your pre-transformed vertices without modification, so you can sort of emulate how it worked in D3D9.  As far as creating vertices with 4 coordinates, that isn't an issue at all - you have pretty much free will to create vertex layouts of the size and type that you want.

#5194161 Best way to Create a Grid

Posted by Jason Z on 22 November 2014 - 02:22 PM

Who needs buffers anyway ? wink.png

cbuffer Parameters
	uint Rows;
	matrix WorldViewProjection;

void LineGridVS(uint vid: SV_VertexID,
	out float4 color: COLOR,
	out float4 position: SV_Position)
    // which row ?
    uint n = vid / 2;	
    // line start or end (column coordinate)
    position.x = (vid % 2) * Rows;	
    // row coordinate (modulo needed for later flip to work)	
    position.z = n % (Rows + 1);
    position.y = 0;
    position.w = 1;
    // center around origin
    position.xz -= (Rows / 2);		
    color = float4(1,0,0,1);
    // rows or columns ? flip x and z (and also give a different color)
    if(n > Rows)
        position.xz = position.zx;
        color = float4(0,1,0,1);
    position = mul(position, WorldViewProjection);		
Don't bind neither vertex nor index buffer nor input layout. Call with context->Draw((rows + 1) * 4, 0); (Edit: Line list topology). Anything else (centering around camera and snapping) can be done with the transformation, as pointed out.

Nice weekend y'all!

Edit2: Minor corrections.



That's a easy way to get a grid on the screen, but it may take more GPU effort than is really needed.  It is usually sufficient just to make a grid and store it in some vertex/index buffers, and then you can easily transform the vertices and simply rasterize the geometry.  It will eliminate the vertex work being done to generate the lines, at the cost of a little bit of bandwidth.

#5192196 D3D11 Graphics Debugging under VS2012 (Missing Call)

Posted by Jason Z on 10 November 2014 - 07:43 PM

That's pretty strange...  for some reason I can't open the log file - it hangs the graphics debugger as soon as I try to open it :(


Even without it though - if you see that the vertex buffer is being set to null, can you check it on your CPU call to see if the buffer is null?  The argument should be directly mirrored with what you see in the log file, so what you are passing to the API should be a null as well.  Perhaps the buffer variable is being overwritten somewhere in between?

#5191724 D3D11 Graphics Debugging under VS2012 (Missing Call)

Posted by Jason Z on 07 November 2014 - 02:19 PM

I can send you the vsglog but if some of my API calls are not even showing up, how will that help you?

You are probably not capturing the first frame where the creation of the buffer takes place.  If you have the vsglog, you can see exactly why a primitive isn't showing up - it could be your input assembler configuration (if your buffer doesn't exist for some reason), it could be your VS transformations, it could be clipping/culling, it could vertex order, it could be depth/stencil buffer issues, it could be alpha blending state misconfigured, or it could even be the output merger state isn't right.  With a vsglog you can clearly identify why a particular draw call ends up the way it does.

#5191668 Resource management

Posted by Jason Z on 07 November 2014 - 08:29 AM

As described, used a raw pointer or reference (to the resource or to the shared_ptr) if the resource is guaranteed to outlive the pointer/reference. There's no way to check whether the resource is still valid, you can only assume.

This method is actually a very valid way to go, since you usually will bundle up the resources to be used in a particular 'level' together.  You can unload the resources when the level is finished (or whatever other logical construct you want to use) and in between you can utilize the naked pointer to your hearts content.  That provides a very lightweight system, and as long as your non-managing code doesn't delete a resource, it would be viable.


Personally I would rather utilize (and do utilize) a proxy in between the resource and its users.  This has many benefits, including the fact that the object that the client code has (the proxy in this case) does not have any ownership at all.  The reference only points to an object, but doesn't have the ability to keep it alive.  When you try to use it, the proxy is used to look up the reference and can check if the resource is still alive.  This lets you assert that there isn't any calls to a resource that was unloaded.


I found that an oldish post on the bitsquid blog was a pretty good reference for this type of discussion: http://bitsquid.blogspot.com/2011/09/managing-decoupling-part-4-id-lookup.html

#5191354 D3D11 Graphics Debugging under VS2012 (Missing Call)

Posted by Jason Z on 05 November 2014 - 11:11 AM

Yes, it looks like you are correctly enabling the debug device, so it should be good. Your log file only shows the closing part of the log though - it doesn't show anything from the startup.  Normally you will see messages about loading dlls and some other things related to the driver.  Did you truncate the log?


Regarding the full stream, I haven't actually done it with the graphics debugger.  Instead, you used to be able to do this with PIX, and I thought the graphics debugger has feature parity (although I may be wrong).  However, it doesn't matter since you proved that the buffers are correctly created with the description calls.


If you take a frame snapshot and save it to file (vsglog) then I can take a quick look to see what is happening there.  I suspect that the buffers are not the issue, but rather the transformations that are used or perhaps a viewport that is not properly set.  You can check the input assembler state to see if it has the buffers bound to it as you expected through the vsglog file.

#5191124 D3D11 Graphics Debugging under VS2012 (Missing Call)

Posted by Jason Z on 04 November 2014 - 09:33 AM

Are you capturing a full stream, or only a frame?  You could try to verify that the buffers were properly created by calling the GetDesc member function and verifying that the object allows you to actually access its data.  That way if your graphics tools are not catching the second buffer creation then you can still rule the creation part out.


Do you also have the debug runtime enabled?  If you enable it, then any obvious misconfigurations (like a potentially missing buffer) will get printed to the output console.