Files
XCEngine/tests/RHI/D3D12/integration/sphere/Res/Shader/sphere.hlsl
ssdfasd 7d1362a41e fix: D3D12 sphere - enable depth write, fix texture UV seam tearing and orientation
- Enable depth write mask (D3D12_DEPTH_WRITE_MASK_ALL) to fix rendering artifacts
- Change texture address mode from Wrap to Clamp to fix UV seam tearing
- Remove V coordinate flip in shader to fix upside-down texture
- Add ground truth screenshot (GT.ppm) for testing
2026-03-22 18:41:11 +08:00

32 lines
755 B
HLSL

struct Vertex {
float4 pos : POSITION;
float4 texcoord : TEXCOORD0;
};
struct VSOut {
float4 pos : SV_POSITION;
float4 texcoord : TEXCOORD0;
};
Texture2D gDiffuseTexture : register(t0);
SamplerState gSampler : register(s0);
cbuffer MatrixBuffer : register(b0) {
float4x4 gProjectionMatrix;
float4x4 gViewMatrix;
float4x4 gModelMatrix;
float4x4 gIT_ModelMatrix;
};
VSOut MainVS(Vertex v) {
VSOut o;
float4 positionWS = mul(gModelMatrix, v.pos);
float4 positionVS = mul(gViewMatrix, positionWS);
o.pos = mul(gProjectionMatrix, positionVS);
o.texcoord = v.texcoord;
return o;
}
float4 MainPS(VSOut i) : SV_TARGET {
return gDiffuseTexture.Sample(gSampler, float2(i.texcoord.x, i.texcoord.y));
}