I use fxc compiler tool to compile a hlsl file, then load those binary file into memory and create shaders. But the problem is I cannot access to other textures in an array of texture (Texture2D arr[10]) except the first one, in the sense that the color I get as sampling is black. However, everything is fine if the hlsl file is compiled at runtime.
The shader source code:
Texture2D g_pTextures[10] : register(t4);
if (Texture_ID == 0)
{
result = g_pTextures[0].SampleLevel(g_samLinear, uv_temp, 0.0f);
color1 = g_pTextures[0].SampleLevel(g_samLinear, uv1, 0.0f);
color2 = g_pTextures[0].SampleLevel(g_samLinear, uv2, 0.0f);
}
else
{
result = g_pTextures[1].SampleLevel(g_samLinear, uv_temp, 0.0f);
color1 = g_pTextures[1].SampleLevel(g_samLinear, uv1, 0.0f);
color2 = g_pTextures[1].SampleLevel(g_samLinear, uv2, 0.0f);
}
Is there anybody helps me, please? Thank in advanced.