Skip to content

Commit

Permalink
Remove half-pixel offset from shaders
Browse files Browse the repository at this point in the history
Zengine DX7 renderer doesn't actually add the half-pixel offset to the rendering position so avoid removing it.
  • Loading branch information
SaiyansKing committed Oct 11, 2022
1 parent d25986b commit 4d16252
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions D3D11Engine/Shaders/VS_Lines_XYZRHW.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ float4 TransformXYZRHW(float4 xyzrhw)
ndc.y = 1 - ((2 * (xyzrhw.y - V_ViewportPos.y)) / V_ViewportSize.y);
ndc.z = xyzrhw.z;

// Remove the stupid half-pixel offset from pre D3D10
ndc.xy -= 0.5f / V_ViewportSize;

// Convert to clip-space. rhw is actually 1/w ("reciprocal"). So to undo the devide by w, devide by the given 1/w.
float actualW = 1.0f / xyzrhw.w;
float3 clipSpace = ndc.xyz * actualW;
Expand Down
3 changes: 0 additions & 3 deletions D3D11Engine/Shaders/VS_TransformedEx.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ float4 TransformXYZRHW(float4 xyzrhw)
ndc.y = 1 - ((2 * (xyzrhw.y - V_ViewportPos.y)) / V_ViewportSize.y);
ndc.z = xyzrhw.z;

// Remove the stupid half-pixel offset from pre D3D10
ndc.xy -= 0.5f / V_ViewportSize;

// Convert to clip-space. rhw is actually 1/w ("reciprocal"). So to undo the devide by w, devide by the given 1/w.
float actualW = 1.0f / xyzrhw.w;
float3 clipSpace = ndc.xyz * actualW;
Expand Down
3 changes: 0 additions & 3 deletions D3D11Engine/Shaders/VS_XYZRHW_DIF_T1.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ float4 TransformXYZRHW(float4 xyzrhw)
ndc.y = 1 - ((2 * (xyzrhw.y - V_ViewportPos.y)) / V_ViewportSize.y);
ndc.z = xyzrhw.z;

// Remove the stupid half-pixel offset from pre D3D10
ndc.xy -= 0.5f / V_ViewportSize;

// Convert to clip-space. rhw is actually 1/w ("reciprocal"). So to undo the devide by w, devide by the given 1/w.
float actualW = 1.0f / xyzrhw.w;
float3 clipSpace = ndc.xyz * actualW;
Expand Down

0 comments on commit 4d16252

Please sign in to comment.