Original Post
Hi, I moved my code from directx 11 to directx 12 and a shader doesn't work correctly.
Material material = mesh_instances[pass_data.mesh_idx].material;
Texture2D<float4> normal_texture = textures[material.normal_texture_index];
Texture2D<float4> diffuse_texture = textures[material.diffuse_texture_index];
Texture2D<float4> specular_texture = textures[material.specular_texture_index];
float3 local_normal = normal_texture.Sample(linear_sampler(), vertex_out.uv).rgb;
float3 normal = normal_mapping(local_normal, vertex_out.normal, vertex_out.tangent);
float3 diffuse = diffuse_texture.Sample(linear_sampler(), vertex_out.uv).rgb;
float3 specular = specular_texture.Sample(linear_sampler(), vertex_out.uv).rgb;Samples methos always return zero and I don't understand what causes it. What I tried.
- Use
SampleLevelwith zero mipmap level. - Use
Load(int3(1024 *vertex_out.uv.x, 1024 *vertex_out.uv.y, 0))I thought maybe SamplerState is broken. - In RenderDoc Pipeline State→Pixel Shader displays all accessed textures.
- Textures were properly filled.
- Descriptors holds right information.
Thanks for your advices.