3
\$\begingroup\$

The GraphicsDevice class of XNA has the properties Textures and VertexTextures.

What is the exact difference? I don't really understand what MSDN tells me about this.

I usually use Effect parameters to pass textures to my HLSL shaders. What are the differences between these methods, which is faster?

\$\endgroup\$
3
  • \$\begingroup\$ No one should be faster. In DX there is bindtoVertex and bindToPixel. They just bind a resource for a certain stage in the shader. \$\endgroup\$
    – Tordin
    Commented Oct 24, 2013 at 8:09
  • \$\begingroup\$ Ok this means I could use a Texture in the Vertex Shader? For what is this useful? Getting VertexColor from a Texture to have some kind of very low res texture? \$\endgroup\$
    – codymanix
    Commented Oct 24, 2013 at 8:43
  • \$\begingroup\$ And what is the difference between passing a user texture as effect parameter and using the Textures collection? \$\endgroup\$
    – codymanix
    Commented Oct 24, 2013 at 8:46

1 Answer 1

2
\$\begingroup\$

GraphicsDevice.Textures are your "traditional" textures; the one's you sample from during the fragment shader.

GraphicsDevice.VertexTextures are textures that you want to sample from in the vertex shader, which required specialized HLSL instructions (texldl, as noted in the documentation) on the D3D9-class hardware that XNA is based on. Vertex textures were a half-measure towards the more unified shader resource input pipe that is available on modern cards, but not via XNA. You probably do not need to concern yourself with the VertexTextures property for the time being.

Using the Effect API to send textures to the shader will, under the hood, do exactly the same set of steps that you would need to do if you manually assigned textures to specific samplers. I would recommend you continue to just use the Effect methods as they are likely going to be easier for you, since you already understand them.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .