Sign in to follow this  
51mon

How to Set Up Custom Mipmapping in DX10?

Recommended Posts

51mon    342
I was doing some custom mipmapping in DX9. I where using the last rendered surface as input when rendering the next level. When trying to port my code to DX10, I got the following message: D3D10: WARNING: ID3D10Device::PSSetShaderResources: Resource being set to PS shader resource slot 0 is still bound on output! Forcing to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD ] D3D10: WARNING: ID3D10Device::PSSetShaderResources: Resource being set to PS shader resource slot 1 is still bound on output! Forcing to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD ] As I understands it DX10 look upon the whole mipmap chain as a single object and therefore not let me ping-pong between the levels. I’m of course not using the same surface as input and output at the same time. Can I fix this somehow? Does someone know about any clever hacks? Thanks

Share this post


Link to post
Share on other sites
51mon    342
One solution as I see it would be to manage my own chain by declare an nonhomogeneous texture array in the fx-file:

Texture2D g_CustomMipmap[Depth];

I’m just confused how to bind the array to the CPU application. I don’t think ID3D10Effect::GetVariableByName works on nonhomogeneous texture arrays. Can I use ID3D10Effect::GetVariableByIndex or something?

Thanks

Share this post


Link to post
Share on other sites
Jalibr    283
Just use GetVariableByName(...)->AsShaderResource()->SetResourceArray(...)

http://msdn2.microsoft.com/en-us/library/bb173697.aspx

Share this post


Link to post
Share on other sites
51mon    342
Thanks Jalibr

I managed to implement the custom mipmapping and the GPU writes to all the levels. In order to follow the DX10 access rules I had to put the different levels in a non-homogenous texture array like this:

Texture2D g_LightTextureDirection[12];

But when I try to read the data like this:

Output.Direction = g_LightTextureDirection[iIndex].Sample( ScreenTextureSampler, vCoord).rgb;

I got problems again, I got this message:

error X3512: sampler array index must be a literal expression

If anyone has an idea of how to solve this, I would be thrilled.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this