Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Jason Z

Member Since 04 Feb 2004
Offline Last Active Today, 06:17 PM

#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.




#5189213 Need some help, can't figure out what's wrong

Posted by Jason Z on 26 October 2014 - 06:56 AM


Ok I am trying to fix it but what does this mean "16 byte aligned boundaries" I don't even know what that is. And why do they have to be 16 byte aligned?

If you go to the link in my original answer, you will have a decent description of what the alignment of an object is, and why it matters in the case of the XMM registers.  I would also like to say, that you have received a number of good answers (and admittedly a few not so good ones too...) which should be more than enough for you to continue on debugging and experimenting on your own.  If someone points you towards alignment issues and you don't know about alignment, start to research it.  If you type in "C++ memory alignment Visual Studio" in Google, I'm 99% sure there is a full explanation waiting for you.  You should be willing to take the second step on your own, instead of waiting for someone to fully explain a basic concept to you.

 

Regarding the declaration syntax for aligned variables, you could do something similar and look up the documentation about the declspec keyword, where you are sure to find answers.  Take the initiative, and you will make much faster progress.




#5188357 [Solved] Stretching bug in Parallax Occlusion Mapping

Posted by Jason Z on 21 October 2014 - 12:45 PM

For case #2, I think that is an authoring problem.  If you assign texture coordinates in such a way that the texture itself is stretched more in one direction, then that is something you need to correct when you create your geometry - it isn't a problem to be solved in your shader!

 

I think the non-uniform scaling is also a very special case type of problem.  Do you really need non-uniform scaling on a cube?  I would say you should simply apply the texture coordinates to the geometry with the appropriate scaling that you want, and then just use uniform scaling and forget about it the issue!




#5188228 [Solved] Stretching bug in Parallax Occlusion Mapping

Posted by Jason Z on 20 October 2014 - 08:18 PM

It is hard to say what the issue is, but I would guess that either your input data incorrect (i.e. your normal space is not correctly defined at each vertex) or perhaps your matrices are not being passed correctly.  I recall seeing this type of error quite a few times during my own work with POM, so it isn't unusual.  My bet is that the matrices are incorrect, but of course that is just a guess...






PARTNERS