Jump to content
  • Advertisement
Sign in to follow this  
janoside

HLSL Render State Changes

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using: Managed DirectX, C#, Effects Framework... I am using a number of HLSL techniques to render objects in my scene. In order to properly apply transparencies of those objects I sort the scene objects into 2 types: opaque and transparent (then sort the transparent ones by view distance). I want to apply this concept to my HLSL-rendered objects and the only way I have found to intercept render state changes in HLSL (since I want to know when AlphaBlendEnable is set to true in HLSL) is setting the StateManager property of my Direct3D Effect object to a custom StateManager. However, when I do this, shutting down my program causes an AccessViolationException to be thrown: "AccessViolationException Attempted to read or write protected memory. This is often an indication that other memory has been corrupted." Let me add that the StateManager that I currently have implemented simply passes on the calls it receives to the Direct3D Device. I have had a hard time figuring out how to intercept state changes from HLSL so any alternate strategies or help on this strategy would be greatly appreciated. Thanks in advance. Janoside

Share this post


Link to post
Share on other sites
Advertisement
Have you tried polling the states of interest from the device's RenderState after your call to BeginPass()?

It seems like there ought to be an easy way to query the states set by a pass. You can use Begin/EndParameterBlock to capture changes, but I don't see how to get any information out of a parameter block handle.

If you have control over your effect files you can always just use an annotation and flag the state changes manually.

Share this post


Link to post
Share on other sites
I appreciate the reply. After posting I realized that intercepting the render-state changes after a BeginPass call is not really what I need. Since I determine the "transparency" of the HLSL technique before any rendering takes place (and sort at that stage), I really need to find the render-state changes at Effect compile time. In addition I want to know the shader profile (vs_1_1, ps_3_0, etc.) that is required by each pass in order to test against the hardware Caps and weed out invalid techniques. Any help is greatly appreciated... I have been unable to find any information on the subject.

Thanks in advance
Janoside

Share this post


Link to post
Share on other sites
I think your best bet at this point is to use annotations. You should be able tack some metadata on your techniques and passes that you can read after you compile and before you begin any passes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!