Skip to content

Commit

Permalink
Merge pull request #3 from polymetal0/master
Browse files Browse the repository at this point in the history
Z-fix test 2
  • Loading branch information
backgamon authored Jan 14, 2025
2 parents 4e2805d + 475bf96 commit 0cd17ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions hw/xbox/nv2a/pgraph/gl/shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,8 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
uint32_t v[2];
v[0] = pgraph_reg_r(pg, NV_PGRAPH_ZCLIPMIN);
v[1] = pgraph_reg_r(pg, NV_PGRAPH_ZCLIPMAX);
float zclip_min = *(float*)&v[0];// / zmax * 2.0 - 1.0;
float zclip_max = *(float*)&v[1];// / zmax * 2.0 - 1.0;
float zclip_min = *(float*)&v[0];
float zclip_max = *(float*)&v[1];
glUniform4f(binding->clip_range_loc, 0, zmax, zclip_min, zclip_max);
}

Expand Down
11 changes: 5 additions & 6 deletions hw/xbox/nv2a/pgraph/glsl/vsh-prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,12 @@ void pgraph_gen_vsh_prog_glsl(uint16_t version,
"- clipRange.x)) - 1;\n");
}
}
mstring_append(body,
" }\n"
);
mstring_append(body,
" }\n"
);
if (z_perspective || texture) {
mstring_append(body, " oPos.xyz *= oPos.w;\n");
} else {

} else {
mstring_append(
body,

Expand All @@ -896,6 +895,6 @@ void pgraph_gen_vsh_prog_glsl(uint16_t version,
* can't multiply by W because it could be meaningless here */
" oPos.w = 1.0;\n"
" }\n"
);
);
}
}
4 changes: 2 additions & 2 deletions hw/xbox/nv2a/pgraph/vk/shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
uint32_t v[2];
v[0] = pgraph_reg_r(pg, NV_PGRAPH_ZCLIPMIN);
v[1] = pgraph_reg_r(pg, NV_PGRAPH_ZCLIPMAX);
float zclip_min = *(float *)&v[0];// / zmax * 2.0 - 1.0;
float zclip_max = *(float *)&v[1];// / zmax * 2.0 - 1.0;
float zclip_min = *(float *)&v[0];
float zclip_max = *(float *)&v[1];

if (binding->clip_range_loc != -1) {
uniform4f(&binding->vertex->uniforms, binding->clip_range_loc, 0,
Expand Down

0 comments on commit 0cd17ee

Please sign in to comment.