From 45724b34e672f1c6970440f9728ff5cb20010d0c Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Sat, 28 Jun 2025 00:08:45 -0700 Subject: [PATCH] nv2a: Drop some unnecessary comments --- hw/xbox/nv2a/pgraph/glsl/psh.c | 5 ----- hw/xbox/nv2a/pgraph/glsl/vsh-ff.c | 8 -------- hw/xbox/nv2a/pgraph/glsl/vsh.c | 5 ----- hw/xbox/nv2a/pgraph/psh.h | 1 - hw/xbox/nv2a/pgraph/shaders.c | 6 ------ 5 files changed, 25 deletions(-) diff --git a/hw/xbox/nv2a/pgraph/glsl/psh.c b/hw/xbox/nv2a/pgraph/glsl/psh.c index 1651b0d06c..df1168fe4a 100644 --- a/hw/xbox/nv2a/pgraph/glsl/psh.c +++ b/hw/xbox/nv2a/pgraph/glsl/psh.c @@ -864,7 +864,6 @@ static MString* psh_convert(struct PixelShader *ps) " vec2(-1.0, 1.0),vec2(0.0, 1.0),vec2(1.0, 1.0));\n" ); - /* Window Clipping */ MString *clip = mstring_new(); mstring_append_fmt(clip, "/* Window-clip (%slusive) */\n", ps->state.window_clip_exclusive ? "Exc" : "Inc"); @@ -891,7 +890,6 @@ static MString* psh_convert(struct PixelShader *ps) "}\n"); } - /* Depth clipping */ if (ps->state.depth_clipping) { if (ps->state.z_perspective) { mstring_append( @@ -1437,7 +1435,6 @@ MString *pgraph_gen_psh_glsl(const PshState state, GenPshGlslOptions opts) void pgraph_set_psh_uniform_values(PGRAPHState *pg, const PshUniformLocs locs, PshUniformValues *values) { - /* update combiner constants */ if (locs[PshUniform_consts] != -1) { for (int i = 0; i < 9; i++) { uint32_t constant[2]; @@ -1477,7 +1474,6 @@ void pgraph_set_psh_uniform_values(PGRAPHState *pg, const PshUniformLocs locs, } } - /* For each texture stage */ for (int i = 0; i < NV2A_MAX_TEXTURES; i++) { /* Bump luminance only during stages 1 - 3 */ if (i > 0) { @@ -1568,7 +1564,6 @@ void pgraph_set_psh_uniform_values(PGRAPHState *pg, const PshUniformLocs locs, values->depthOffset[0] = zbias; } - /* Clipping regions */ unsigned int max_gl_width = pg->surface_binding_dim.width; unsigned int max_gl_height = pg->surface_binding_dim.height; pgraph_apply_scaling_factor(pg, &max_gl_width, &max_gl_height); diff --git a/hw/xbox/nv2a/pgraph/glsl/vsh-ff.c b/hw/xbox/nv2a/pgraph/glsl/vsh-ff.c index 609eec6f26..c970c31761 100644 --- a/hw/xbox/nv2a/pgraph/glsl/vsh-ff.c +++ b/hw/xbox/nv2a/pgraph/glsl/vsh-ff.c @@ -35,7 +35,6 @@ void pgraph_gen_vsh_ff_glsl(const VshState *state, MString *header, { int i, j; - /* generate vertex shader mimicking fixed function */ mstring_append(header, "#define position v0\n" "#define weight v1\n" @@ -111,7 +110,6 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz "\n" ); - /* Skinning */ unsigned int count; bool mix; switch (state->fixed_function.skinning) { @@ -143,12 +141,10 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz "tNormal", "vec4(normal, 0.0)", "invModelViewMat", "xyz"); - /* Normalization */ if (state->fixed_function.normalization) { mstring_append(body, "tNormal = normalize(tNormal);\n"); } - /* Texgen */ for (i = 0; i < NV2A_MAX_TEXTURES; i++) { mstring_append_fmt(body, "/* Texgen for stage %d */\n", i); @@ -213,7 +209,6 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz } } - /* Apply texture matrices */ for (i = 0; i < NV2A_MAX_TEXTURES; i++) { if (state->fixed_function.texture_matrix_enable[i]) { mstring_append_fmt(body, @@ -222,7 +217,6 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz } } - /* Lighting */ if (!state->fixed_function.lighting) { mstring_append(body, " oD0 = diffuse;\n"); mstring_append(body, " oD1 = specular;\n"); @@ -417,9 +411,7 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz } } - /* Fog */ if (state->fog_enable) { - /* From: https://www.opengl.org/registry/specs/NV/fog_distance.txt */ switch(state->fixed_function.foggen) { case FOGGEN_SPEC_ALPHA: diff --git a/hw/xbox/nv2a/pgraph/glsl/vsh.c b/hw/xbox/nv2a/pgraph/glsl/vsh.c index ea61b851e9..0e2f69853b 100644 --- a/hw/xbox/nv2a/pgraph/glsl/vsh.c +++ b/hw/xbox/nv2a/pgraph/glsl/vsh.c @@ -175,8 +175,6 @@ MString *pgraph_gen_vsh_glsl(const VshState *state, state->programmable.program_length, header, body); } - /* Fog */ - if (state->fog_enable) { if (!state->is_fixed_function) { @@ -240,7 +238,6 @@ MString *pgraph_gen_vsh_glsl(const VshState *state, assert(false); break; } - /* Calculate absolute for the modes which need it */ switch (state->fog_mode) { case FOG_MODE_LINEAR_ABS: case FOG_MODE_EXP_ABS: @@ -264,7 +261,6 @@ MString *pgraph_gen_vsh_glsl(const VshState *state, mstring_append(body, " oFog = vec4(1.0);\n"); } - /* Set outputs */ mstring_append(body, "\n" " vtxD0 = clamp(NaNToOne(oD0), 0.0, 1.0);\n" " vtxB0 = clamp(NaNToOne(oB0), 0.0, 1.0);\n" @@ -405,7 +401,6 @@ void pgraph_set_vsh_uniform_values(PGRAPHState *pg, const VshState *state, } if (state->is_fixed_function) { - /* update lighting constants */ if (locs[VshUniform_ltctxa] != -1) { QEMU_BUILD_BUG_MSG(sizeof(values->ltctxa) != sizeof(pg->ltctxa), "Uniform value size inconsistency"); diff --git a/hw/xbox/nv2a/pgraph/psh.h b/hw/xbox/nv2a/pgraph/psh.h index 2711114349..fa207ee079 100644 --- a/hw/xbox/nv2a/pgraph/psh.h +++ b/hw/xbox/nv2a/pgraph/psh.h @@ -52,7 +52,6 @@ enum ConvolutionFilter { }; typedef struct PshState { - /* fragment shader - register combiner stuff */ uint32_t combiner_control; uint32_t shader_stage_program; uint32_t other_stage_input; diff --git a/hw/xbox/nv2a/pgraph/shaders.c b/hw/xbox/nv2a/pgraph/shaders.c index 83415b464d..65d396f030 100644 --- a/hw/xbox/nv2a/pgraph/shaders.c +++ b/hw/xbox/nv2a/pgraph/shaders.c @@ -59,7 +59,6 @@ static void set_fixed_function_vsh_state(PGRAPHState *pg, ff->local_eye = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_LOCALEYE); - /* color material */ ff->emission_src = (enum MaterialColorSource)GET_MASK( pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_EMISSION); ff->ambient_src = (enum MaterialColorSource)GET_MASK( @@ -69,12 +68,10 @@ static void set_fixed_function_vsh_state(PGRAPHState *pg, ff->specular_src = (enum MaterialColorSource)GET_MASK( pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_SPECULAR); - /* Texture matrices */ for (int i = 0; i < 4; i++) { ff->texture_matrix_enable[i] = pg->texture_matrix_enable[i]; } - /* Texgen */ for (int i = 0; i < 4; i++) { unsigned int reg = (i < 2) ? NV_PGRAPH_CSV1_A : NV_PGRAPH_CSV1_B; for (int j = 0; j < 4; j++) { @@ -89,7 +86,6 @@ static void set_fixed_function_vsh_state(PGRAPHState *pg, } } - /* Lighting */ ff->lighting = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_LIGHTING); if (ff->lighting) { @@ -170,7 +166,6 @@ static void set_vsh_state(PGRAPHState *pg, VshState *vsh) NV_PGRAPH_CONTROL_3_SHADEMODE) == NV_PGRAPH_CONTROL_3_SHADEMODE_SMOOTH; - /* Fog */ vsh->fog_enable = pgraph_reg_r(pg, NV_PGRAPH_CONTROL_3) & NV_PGRAPH_CONTROL_3_FOGENABLE; if (vsh->fog_enable) { @@ -229,7 +224,6 @@ static void set_psh_state(PGRAPHState *pg, PshState *psh) NV_PGRAPH_ZCOMPRESSOCCLUDE_ZCLAMP_EN) == NV_PGRAPH_ZCOMPRESSOCCLUDE_ZCLAMP_EN_CULL; - /* Copy content of enabled combiner stages */ int num_stages = pgraph_reg_r(pg, NV_PGRAPH_COMBINECTL) & 0xFF; for (int i = 0; i < num_stages; i++) { psh->rgb_inputs[i] = pgraph_reg_r(pg, NV_PGRAPH_COMBINECOLORI0 + i * 4);