Skip to content

Commit

Permalink
nv2a: Fix missing flat qualifier for inv_w param
Browse files Browse the repository at this point in the history
`vtx_inv_w` should also be flat, since interpolating it causes incorrect values
for the flat shaded colors.

Fixes #1179

[Test](https://github.com/abaire/nxdk_pgraph_tests/blob/main/src/tests/shade_model_tests.cpp)
[HW results](https://github.com/abaire/nxdk_pgraph_tests_golden_results/wiki/Results-Shade_model)
  • Loading branch information
abaire authored and mborgerson committed Jul 13, 2022
1 parent 4fd15c0 commit ae1a140
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hw/xbox/nv2a/shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static MString* generate_geometry_shader(
"void emit_vertex(int index, int provoking_index) {\n"
" gl_Position = gl_in[index].gl_Position;\n"
" gl_PointSize = gl_in[index].gl_PointSize;\n"
" vtx_inv_w = v_vtx_inv_w[index];\n"
" vtx_inv_w = v_vtx_inv_w[provoking_index];\n"
" vtxD0 = v_vtxD0[provoking_index];\n"
" vtxD1 = v_vtxD1[provoking_index];\n"
" vtxB0 = v_vtxB0[provoking_index];\n"
Expand Down
2 changes: 1 addition & 1 deletion hw/xbox/nv2a/shaders_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "debug.h"

#define DEF_VERTEX_DATA(qualifier, in_out, prefix, suffix) \
"noperspective " in_out " float " prefix "vtx_inv_w" suffix ";\n" \
qualifier " " in_out " float " prefix "vtx_inv_w" suffix ";\n" \
qualifier " " in_out " vec4 " prefix "vtxD0" suffix ";\n" \
qualifier " " in_out " vec4 " prefix "vtxD1" suffix ";\n" \
qualifier " " in_out " vec4 " prefix "vtxB0" suffix ";\n" \
Expand Down

0 comments on commit ae1a140

Please sign in to comment.