用于设置HLSL着色器参数的DirectX API接受相应参数占用的插槽的参数。这些插槽号是否在所有资源类型之间全局共享,或者每种类型都有自己唯一的插槽号集。 'type',我的意思是内在的HLSL结构,如cbuffers,纹理,采样器等。
这是一个假设的HLSL着色器文件,用于说明我的问题。
// Note the order I declare things here is for the purpose of the question,
// not how I would declare them in a real shader file.
// First constant buffer and first item, definitely at index 0.
cbuffer PerFrameData
{
// stuff
};
// Is this texture at index 0 because its the first texture
// declared, or index 1 because it's the second item declared?
Texture2D firstTexture;
// Second cbuffer, third declared - index 1 or 2?
cbuffer PerObjectData
{
// stuff
};
// Second texture, fourth declared - index 1 or 3?
Texture2D secondTexture;
// This sampler is declared last, do I use index 0 or 4?
SamplerState texSampler;
答案 0 :(得分:1)
这是按类型。
例如PerFrameData
位于插槽0,PerObjectData
位于插槽1上,等等...您使用XXSetConstantBuffers
设置它们, XX 是管道阶段。
检查man以查看在舞台中设置不同类型的所有方法。