- Viewing Profile: Posts: relaxok
Community Stats
- Group Members
- Active Posts 24
- Profile Views 242
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
User Tools
Contacts
relaxok hasn't added any contacts yet.
Posts I've Made
In Topic: Multiple draw calls unable to use different OMSetBlendState?
02 April 2012 - 10:00 PM
Apparently, you can't bind a cbuffer to to register cb1 and set it in code to slot 1, if there's nothing in slot 0. If you do, the shader will just use garbage data for the values in your cbuffer structure (well, seemed to be 0's in this case).
I don't know if this is a driver bug or just a quirk, but there you go.
In Topic: Multiple draw calls unable to use different OMSetBlendState?
02 April 2012 - 06:15 PM
Assuming you aren't using deferred contexts then all draw calls are executed when the draw functions are called' nothing is deferred until 'later' and all state during execution would be as it is when that call is made.
I am using deferred contexts but only to prepare buffers and stuff, not when drawing...
Everyone always tells me it's just a PIX bug if it shows wrong values in registers and that it's not reliable.. I guess i can't really be sure until i get a machine with 2 videcoards and can debug shaders with nsight?
This is flat out insane that it seems to be doing this..
In Topic: Multiple draw calls unable to use different OMSetBlendState?
02 April 2012 - 03:26 PM
OMSetBlendState isn't so much 'per draw call' as it is 'set until it is changed again'.
Based on what you are seeing it sounds like on the 2nd run of the rendering loop the blend state isn't being set correctly, which I personally would attribute to a bug in your code rather than any sort of DX/driver issues.
The best advice I can give is to look at the device state at each draw call in PIX to see what is going on; you'll probably want to capture a couple of frames and certainly will want to grab the first frame to see if your state is even being set correctly.
Speaking of PIX this kind of relates to the other issue -- if i use PIX, the values in the lighting params constant buffer seem to be wrong as if they're using the values from the most recent map/unmap to the cbuffer. The same deal as the above, im updating the lighting cbuffer inbetween draw calls but in PIX when i debug that first draw call, the registers show the values of what would be the cbuffer state used for the 2nd draw call.
I thought maybe these two items were both related to some setup/config error, where all the draw calls are actually deferred to the end and only use the 'last' states set in the frame.
If i debug the copy to cbuffer, or the OMSetBlendState and look at the values they're 100% correct. It is however wrong in practice and in PIX.
Again, PIX shows cbuffer values set inbewteen 1st and 2nd draw call, even when looking at the device state during the first draw call.
In Topic: Multiple draw calls unable to use different OMSetBlendState?
02 April 2012 - 02:25 PM
try drawing transparent objects last. You should always draw the transparent objects last anyway so that they have something to blend with on the back buffer. if they are drawn first, they will only blend with whatever is drawn before them, which in this case, it sounds like nothing is drawn before the transparent object, so it probably doesn't appear transparent if it happens to be in front of the opaque object, since the opaque object is drawn last, hope that makes sense
Otherwise, try just adding the line "clip(diffuse.a - 0.25f);" in your pixel shader. this will "clip" or just not draw any pixels with an alpha value of less than .25.
Hmm let me try to be more clear.. i'm drawing 2 meshes
1) uses a transparent blend state, imagine a model of a plant where you want to not render the parts of the texture that have 0 alpha
2) drawn opaquely - blending turned off. this is just a regular basic textured model mesh
the two meshes are not the same object, the geometry is in different areas.
i do the following
1) set blend state to the alpha enabled state (your basic alpha, inv alpha blend)
2) draw mesh #1 (needs this transparency)
3) set blend state to the blend disabled state
4) draw mesh #2 (needs to be opaque)
The result on the backbuffer is that mesh #1 is drawn opaquely, not just mesh #2.
If i change the code to draw mesh #1 only, it is drawn correctly with transparency.
This seems to indicate that the first blend state I set is not used for the first draw call.
Regardless of best practices for rendering order, doesn't this seem wrong?
In Topic: How is it possible for the output register in a pixel shader to differ from P...
29 February 2012 - 02:00 AM
Solved!! The person who mentioned the floating point comparisons was on the right track. I needed to be round()-ing the floats, not just casting to int. There were apparently lots of 250.999999 in there (Showing up as 251.000 in PIX) and int was rounding them down to 250 which is a different set of textures in TexIndices... and so on for other areas of the terrain.
Thanks to MaulingMonkey on gamedev irc..
And thanks to all for your suggestions, I learned a lot along the way..
- Home
- » Viewing Profile: Posts: relaxok

Find content