From 23f63243b52d290b4c979ff5f177e8e059156d34 Mon Sep 17 00:00:00 2001 From: espes Date: Thu, 4 Feb 2016 02:17:15 +1000 Subject: [PATCH] use more named constants in nv2a_shaders.c --- hw/xbox/nv2a_shaders.c | 12 ++++++------ hw/xbox/nv2a_shaders.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/xbox/nv2a_shaders.c b/hw/xbox/nv2a_shaders.c index a4f2526dae..be2fcac8fa 100644 --- a/hw/xbox/nv2a_shaders.c +++ b/hw/xbox/nv2a_shaders.c @@ -356,7 +356,7 @@ GLSL_DEFINE(sceneAmbientColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_FR_AMB) ".xyz") } /* Texgen */ - for (i = 0; i < 4 /* FIXME: NV2A_MAX_TEXTURES */; i++) { + for (i = 0; i < NV2A_MAX_TEXTURES; i++) { qstring_append_fmt(body, "/* Texgen for stage %d */\n", i); /* Set each component individually */ @@ -423,7 +423,7 @@ GLSL_DEFINE(sceneAmbientColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_FR_AMB) ".xyz") } /* Apply texture matrices */ - for (i = 0; i < 4; i++) { + for (i = 0; i < NV2A_MAX_TEXTURES; i++) { if (state.texture_matrix_enable[i]) { qstring_append_fmt(body, "oT%d = oT%d * texMat%d;\n", @@ -634,7 +634,7 @@ STRUCT_VERTEX_DATA); qstring_append_fmt(header, "#define vtx %c_vtx\n", vtx_prefix); qstring_append(header, "\n"); - for(i = 0; i < 16; i++) { + for(i = 0; i < NV2A_VERTEXSHADER_ATTRIBUTES; i++) { qstring_append_fmt(header, "in vec4 v%d;\n", i); } qstring_append(header, "\n"); @@ -829,7 +829,7 @@ ShaderBinding* generate_shaders(const ShaderState state) /* Bind attributes for vertices */ - for(i = 0; i < 16; i++) { + for(i = 0; i < NV2A_VERTEXSHADER_ATTRIBUTES; i++) { snprintf(tmp, sizeof(tmp), "v%d", i); glBindAttribLocation(program, i, tmp); } @@ -863,7 +863,7 @@ ShaderBinding* generate_shaders(const ShaderState state) glUseProgram(program); /* set texture samplers */ - for (i = 0; i < 4; i++) { + for (i = 0; i < NV2A_MAX_TEXTURES; i++) { char samplerName[16]; snprintf(samplerName, sizeof(samplerName), "texSamp%d", i); GLint texSampLoc = glGetUniformLocation(program, samplerName); @@ -895,7 +895,7 @@ ShaderBinding* generate_shaders(const ShaderState state) } } ret->alpha_ref_loc = glGetUniformLocation(program, "alphaRef"); - for (i = 1; i < 4; i++) { + for (i = 1; i < NV2A_MAX_TEXTURES; i++) { snprintf(tmp, sizeof(tmp), "bumpMat%d", i); ret->bump_mat_loc[i] = glGetUniformLocation(program, tmp); snprintf(tmp, sizeof(tmp), "bumpScale%d", i); diff --git a/hw/xbox/nv2a_shaders.h b/hw/xbox/nv2a_shaders.h index 1cc15c5e59..fab6438529 100644 --- a/hw/xbox/nv2a_shaders.h +++ b/hw/xbox/nv2a_shaders.h @@ -87,9 +87,9 @@ typedef struct ShaderBinding { GLint psh_constant_loc[9][2]; GLint alpha_ref_loc; - GLint bump_mat_loc[4]; - GLint bump_scale_loc[4]; - GLint bump_offset_loc[4]; + GLint bump_mat_loc[NV2A_MAX_TEXTURES]; + GLint bump_scale_loc[NV2A_MAX_TEXTURES]; + GLint bump_offset_loc[NV2A_MAX_TEXTURES]; GLint surface_size_loc; GLint clip_range_loc;