Textures to samplers in DX9?

Started by
1 comment, last by MJP 14 years, 2 months ago
I'm working heavily on my shaders right now. Half the time, that means kicking out the use of a few textures altogether to see if the rest of the coordinates are arriving correctly (especially when adding a new texture). Right now everytime I set a texture, it's set to a given sampler number instead of texture name. That means, that when I kick out the rest I all of a sudden use the lightmap for texturing my objects - slowing my debugging down by a lot more. Is it possible to get an index for to which sampler a given named texture is bound? Pretty much the same as you have in OpenGL? That way you can check if it isn't -1 and otherwise not bind at all. Thanks in advance
Advertisement

I'm not sure I follow, but I'm wondering why you set up the textures to a sampler number in the first place. Is there any reason you don't want to name the textures and samplers appropriately in the shader and set them by name in your app? It's a bit more typing, but that way when you call tex2D(lightmapSampler) you'll know it is the lightmap.

Or am I completely misunderstanding your setup? [smile]
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Shaders have full reflection capabilities, which let you find out the bound register index given the name of variable or sampler. Use ID3DXConstantTable::GetConstantDesc for shader constants, and ID3DXConstantTable::GetSamplerIndex for samplers.

This topic is closed to new replies.

Advertisement