0
\$\begingroup\$

I would like to use the stencil information in my depthstencil buffer as shaderresourceview (DX11) in my shader. I have a DSV D24S8 from which I create a R24X8 resource fine using the red for shadowing but can't use the X8 of course So I try to create a parallel resource X24G8. DX says no error but I'm not sure this is allowed or can work as what I get is a black square when i visualize the stencil X24G8 resource on the screen using the green chanel. Or maybe I'm not reading this correctly. I just send the green value to the pixel shader or try other multiplication stuff to modifty the value but nothing changes.

Is it even possible to create a resource from stencil or a texture declaration in shader can be used to reinterpret the data from R24X8?

thanks

\$\endgroup\$
11
  • \$\begingroup\$ How do your shaders work? \$\endgroup\$ Commented Mar 7, 2022 at 12:46
  • \$\begingroup\$ can you be more presice on that question. I'm currently using the depth stencil red channel for shadows. As I'm doing stencil mirror I would like to use the stencil data too for some specific calculation for mirrors. \$\endgroup\$ Commented Mar 7, 2022 at 13:09
  • \$\begingroup\$ if you're talking about the shader for the stencil it is at the moment only a simple shader just to see the texture content on the screen: color = txdiffuse.sample(sampoint, input.tex).g. with txdiffuse being the depth buffer content used as its shaderresourceview in format X24typeless_G8_uint. \$\endgroup\$ Commented Mar 7, 2022 at 13:23
  • \$\begingroup\$ What type is txdiffuse? \$\endgroup\$ Commented Mar 7, 2022 at 13:45
  • \$\begingroup\$ Texture2D txDiffuse : register(t0); may I set a specific format like <float2> \$\endgroup\$ Commented Mar 7, 2022 at 13:56

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.