简体   繁体   English

在D3D10中的着色器的常量缓冲区中设置纹理

[英]Setting a Texture in a shader's constant buffer in D3D10

Ok I have a shader compiled up under D3D10. 好的,我在D3D10下编译了一个着色器。

I am obtaining a shader reflection to get details of all the constants/globals in the shader. 我正在获取着色器反射,以获取着色器中所有常量/全局变量的详细信息。 However I'm a little confused on something ... how do I set a texture to a constant buffer? 但是,我对某些事情有些困惑……如何将纹理设置为恒定缓冲区?

I assume I don't just Map the constant buffer and copy the ID3D10Texture pointer into it ... I assume I use an ID3D10ShaderResourceView but I'm just unsure of how I set it in the constant buffer. 我假设我不只是映射常量缓冲区并将ID3D10Texture指针复制到其中...我假设我使用了ID3D10ShaderResourceView,但是我不确定如何在常量缓冲区中进行设置。

Any help would be much appreciated! 任何帮助将非常感激!

You don't bind a texture to a constant buffer. 您不会将纹理绑定到常量缓冲区。 You bind textures, via views, to a stage (here GS stage) using method: 您可以使用以下方法通过视图将纹理绑定到一个阶段(此处为GS阶段):

void GSSetShaderResources(
  [in]  UINT StartSlot,
  [in]  UINT NumViews,
  [in]  ID3D10ShaderResourceView *ppShaderResourceViews
);

Views and CBs are actually two separate things. 视图和CB实际上是两个独立的事物。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM