0

g_MeshTexture : texture file name

sampler MeshTextureSampler = 
sampler_state
{
    Texture = <g_MeshTexture>;
    MipFilter = LINEAR;
    MinFilter = LINEAR;
    MagFilter = LINEAR;
};

: sampler

I use "tex2D(MeshTextureSampler, In.TextureUV)"

Which condition in HLSL is similar to if(g_MeshTexture == NULL) in C++?

Gimun Eom
  • 411
  • 5
  • 17

1 Answers1

2

There's nothing built-in for HLSL to test this.

You can add an extra client-loaded parameter to tell the shader if the texture is valid or not, or create a second alternative shader that executes without that texture read in cases where the texture isn't deined (and assigned by the client C++ prog)

bjorke
  • 3,295
  • 1
  • 16
  • 20