nv2a: Drop some unnecessary comments

This commit is contained in:
Matt Borgerson 2025-06-28 00:08:45 -07:00 committed by mborgerson
parent c88bac1706
commit 45724b34e6
5 changed files with 0 additions and 25 deletions

View File

@ -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" " vec2(-1.0, 1.0),vec2(0.0, 1.0),vec2(1.0, 1.0));\n"
); );
/* Window Clipping */
MString *clip = mstring_new(); MString *clip = mstring_new();
mstring_append_fmt(clip, "/* Window-clip (%slusive) */\n", mstring_append_fmt(clip, "/* Window-clip (%slusive) */\n",
ps->state.window_clip_exclusive ? "Exc" : "Inc"); ps->state.window_clip_exclusive ? "Exc" : "Inc");
@ -891,7 +890,6 @@ static MString* psh_convert(struct PixelShader *ps)
"}\n"); "}\n");
} }
/* Depth clipping */
if (ps->state.depth_clipping) { if (ps->state.depth_clipping) {
if (ps->state.z_perspective) { if (ps->state.z_perspective) {
mstring_append( 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, void pgraph_set_psh_uniform_values(PGRAPHState *pg, const PshUniformLocs locs,
PshUniformValues *values) PshUniformValues *values)
{ {
/* update combiner constants */
if (locs[PshUniform_consts] != -1) { if (locs[PshUniform_consts] != -1) {
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
uint32_t constant[2]; 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++) { for (int i = 0; i < NV2A_MAX_TEXTURES; i++) {
/* Bump luminance only during stages 1 - 3 */ /* Bump luminance only during stages 1 - 3 */
if (i > 0) { if (i > 0) {
@ -1568,7 +1564,6 @@ void pgraph_set_psh_uniform_values(PGRAPHState *pg, const PshUniformLocs locs,
values->depthOffset[0] = zbias; values->depthOffset[0] = zbias;
} }
/* Clipping regions */
unsigned int max_gl_width = pg->surface_binding_dim.width; unsigned int max_gl_width = pg->surface_binding_dim.width;
unsigned int max_gl_height = pg->surface_binding_dim.height; unsigned int max_gl_height = pg->surface_binding_dim.height;
pgraph_apply_scaling_factor(pg, &max_gl_width, &max_gl_height); pgraph_apply_scaling_factor(pg, &max_gl_width, &max_gl_height);

View File

@ -35,7 +35,6 @@ void pgraph_gen_vsh_ff_glsl(const VshState *state, MString *header,
{ {
int i, j; int i, j;
/* generate vertex shader mimicking fixed function */
mstring_append(header, mstring_append(header,
"#define position v0\n" "#define position v0\n"
"#define weight v1\n" "#define weight v1\n"
@ -111,7 +110,6 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz
"\n" "\n"
); );
/* Skinning */
unsigned int count; unsigned int count;
bool mix; bool mix;
switch (state->fixed_function.skinning) { 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)", "tNormal", "vec4(normal, 0.0)",
"invModelViewMat", "xyz"); "invModelViewMat", "xyz");
/* Normalization */
if (state->fixed_function.normalization) { if (state->fixed_function.normalization) {
mstring_append(body, "tNormal = normalize(tNormal);\n"); mstring_append(body, "tNormal = normalize(tNormal);\n");
} }
/* Texgen */
for (i = 0; i < NV2A_MAX_TEXTURES; i++) { for (i = 0; i < NV2A_MAX_TEXTURES; i++) {
mstring_append_fmt(body, "/* Texgen for stage %d */\n", mstring_append_fmt(body, "/* Texgen for stage %d */\n",
i); 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++) { for (i = 0; i < NV2A_MAX_TEXTURES; i++) {
if (state->fixed_function.texture_matrix_enable[i]) { if (state->fixed_function.texture_matrix_enable[i]) {
mstring_append_fmt(body, 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) { if (!state->fixed_function.lighting) {
mstring_append(body, " oD0 = diffuse;\n"); mstring_append(body, " oD0 = diffuse;\n");
mstring_append(body, " oD1 = specular;\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) { if (state->fog_enable) {
/* From: https://www.opengl.org/registry/specs/NV/fog_distance.txt */ /* From: https://www.opengl.org/registry/specs/NV/fog_distance.txt */
switch(state->fixed_function.foggen) { switch(state->fixed_function.foggen) {
case FOGGEN_SPEC_ALPHA: case FOGGEN_SPEC_ALPHA:

View File

@ -175,8 +175,6 @@ MString *pgraph_gen_vsh_glsl(const VshState *state,
state->programmable.program_length, header, body); state->programmable.program_length, header, body);
} }
/* Fog */
if (state->fog_enable) { if (state->fog_enable) {
if (!state->is_fixed_function) { if (!state->is_fixed_function) {
@ -240,7 +238,6 @@ MString *pgraph_gen_vsh_glsl(const VshState *state,
assert(false); assert(false);
break; break;
} }
/* Calculate absolute for the modes which need it */
switch (state->fog_mode) { switch (state->fog_mode) {
case FOG_MODE_LINEAR_ABS: case FOG_MODE_LINEAR_ABS:
case FOG_MODE_EXP_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"); mstring_append(body, " oFog = vec4(1.0);\n");
} }
/* Set outputs */
mstring_append(body, "\n" mstring_append(body, "\n"
" vtxD0 = clamp(NaNToOne(oD0), 0.0, 1.0);\n" " vtxD0 = clamp(NaNToOne(oD0), 0.0, 1.0);\n"
" vtxB0 = clamp(NaNToOne(oB0), 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) { if (state->is_fixed_function) {
/* update lighting constants */
if (locs[VshUniform_ltctxa] != -1) { if (locs[VshUniform_ltctxa] != -1) {
QEMU_BUILD_BUG_MSG(sizeof(values->ltctxa) != sizeof(pg->ltctxa), QEMU_BUILD_BUG_MSG(sizeof(values->ltctxa) != sizeof(pg->ltctxa),
"Uniform value size inconsistency"); "Uniform value size inconsistency");

View File

@ -52,7 +52,6 @@ enum ConvolutionFilter {
}; };
typedef struct PshState { typedef struct PshState {
/* fragment shader - register combiner stuff */
uint32_t combiner_control; uint32_t combiner_control;
uint32_t shader_stage_program; uint32_t shader_stage_program;
uint32_t other_stage_input; uint32_t other_stage_input;

View File

@ -59,7 +59,6 @@ static void set_fixed_function_vsh_state(PGRAPHState *pg,
ff->local_eye = ff->local_eye =
GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_LOCALEYE); GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_LOCALEYE);
/* color material */
ff->emission_src = (enum MaterialColorSource)GET_MASK( ff->emission_src = (enum MaterialColorSource)GET_MASK(
pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_EMISSION); pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_EMISSION);
ff->ambient_src = (enum MaterialColorSource)GET_MASK( 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( ff->specular_src = (enum MaterialColorSource)GET_MASK(
pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_SPECULAR); pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_SPECULAR);
/* Texture matrices */
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
ff->texture_matrix_enable[i] = pg->texture_matrix_enable[i]; ff->texture_matrix_enable[i] = pg->texture_matrix_enable[i];
} }
/* Texgen */
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
unsigned int reg = (i < 2) ? NV_PGRAPH_CSV1_A : NV_PGRAPH_CSV1_B; unsigned int reg = (i < 2) ? NV_PGRAPH_CSV1_A : NV_PGRAPH_CSV1_B;
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
@ -89,7 +86,6 @@ static void set_fixed_function_vsh_state(PGRAPHState *pg,
} }
} }
/* Lighting */
ff->lighting = ff->lighting =
GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_LIGHTING); GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C), NV_PGRAPH_CSV0_C_LIGHTING);
if (ff->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) ==
NV_PGRAPH_CONTROL_3_SHADEMODE_SMOOTH; NV_PGRAPH_CONTROL_3_SHADEMODE_SMOOTH;
/* Fog */
vsh->fog_enable = vsh->fog_enable =
pgraph_reg_r(pg, NV_PGRAPH_CONTROL_3) & NV_PGRAPH_CONTROL_3_FOGENABLE; pgraph_reg_r(pg, NV_PGRAPH_CONTROL_3) & NV_PGRAPH_CONTROL_3_FOGENABLE;
if (vsh->fog_enable) { 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) ==
NV_PGRAPH_ZCOMPRESSOCCLUDE_ZCLAMP_EN_CULL; NV_PGRAPH_ZCOMPRESSOCCLUDE_ZCLAMP_EN_CULL;
/* Copy content of enabled combiner stages */
int num_stages = pgraph_reg_r(pg, NV_PGRAPH_COMBINECTL) & 0xFF; int num_stages = pgraph_reg_r(pg, NV_PGRAPH_COMBINECTL) & 0xFF;
for (int i = 0; i < num_stages; i++) { for (int i = 0; i < num_stages; i++) {
psh->rgb_inputs[i] = pgraph_reg_r(pg, NV_PGRAPH_COMBINECOLORI0 + i * 4); psh->rgb_inputs[i] = pgraph_reg_r(pg, NV_PGRAPH_COMBINECOLORI0 + i * 4);