diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index f42e254..139cdec 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -171,7 +171,6 @@ static GLuint blit_build_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, { GLuint fs_id; char shader_buf[4096]; - int is_shad; const char *twm; const char *ext_str = ""; char dest_swizzle_snippet[DEST_SWIZZLE_SNIPPET_SIZE] = "texel"; @@ -218,7 +217,7 @@ static GLuint blit_build_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, FS_TEXFETCH_COL_GL, ext_str, vec4_type_for_tgsi_ret(tgsi_ret), vrend_shader_samplerreturnconv(tgsi_ret), - vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target, &is_shad), twm, + vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), twm, dest_swizzle_snippet); fs_id = glCreateShader(GL_FRAGMENT_SHADER); @@ -239,7 +238,6 @@ static GLuint blit_build_frag_tex_col_msaa(struct vrend_blitter_ctx *blit_ctx, { GLuint fs_id; char shader_buf[4096]; - int is_shad; const char *twm; const char *ivec; char dest_swizzle_snippet[DEST_SWIZZLE_SNIPPET_SIZE] = "texel"; @@ -270,7 +268,7 @@ static GLuint blit_build_frag_tex_col_msaa(struct vrend_blitter_ctx *blit_ctx, : FS_TEXFETCH_COL_MSAA_GL, ext_str, vec4_type_for_tgsi_ret(tgsi_ret), vrend_shader_samplerreturnconv(tgsi_ret), - vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target, &is_shad), + vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), nr_samples, ivec, twm, dest_swizzle_snippet); VREND_DEBUG(dbg_blit, NULL, "-- Blit FS shader MSAA -----------------\n" @@ -290,7 +288,6 @@ static GLuint blit_build_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, { GLuint fs_id; char shader_buf[4096]; - int is_shad; const char *twm; switch (tgsi_tex_target) { @@ -330,7 +327,7 @@ static GLuint blit_build_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, snprintf(shader_buf, 4096, blit_ctx->use_gles ? FS_TEXFETCH_DS_GLES : FS_TEXFETCH_DS_GL, - vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target, &is_shad), twm); + vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), twm); fs_id = glCreateShader(GL_FRAGMENT_SHADER); @@ -346,7 +343,6 @@ static GLuint blit_build_frag_blit_msaa_depth(struct vrend_blitter_ctx *blit_ctx { GLuint fs_id; char shader_buf[4096]; - int is_shad; const char *twm; const char *ivec; @@ -368,7 +364,7 @@ static GLuint blit_build_frag_blit_msaa_depth(struct vrend_blitter_ctx *blit_ctx snprintf(shader_buf, 4096, blit_ctx->use_gles ? (is_array ? FS_TEXFETCH_DS_MSAA_ARRAY_GLES : FS_TEXFETCH_DS_MSAA_GLES) : FS_TEXFETCH_DS_MSAA_GL, - vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target, &is_shad), ivec, twm); + vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), ivec, twm); fs_id = glCreateShader(GL_FRAGMENT_SHADER); diff --git a/src/vrend_shader.c b/src/vrend_shader.c index f514cc9..76b8bea 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -5348,7 +5348,7 @@ char vrend_shader_samplerreturnconv(enum tgsi_return_type type) } } -const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type, int *is_shad) +const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type) { switch (sampler_type) { case TGSI_TEXTURE_BUFFER: return "Buffer"; @@ -5362,13 +5362,11 @@ const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type, int *i case TGSI_TEXTURE_RECT: return use_gles ? "2D" : "2DRect"; case TGSI_TEXTURE_SHADOW1D: if (!use_gles) { - *is_shad = 1; return "1DShadow"; } /* fallthrough */ - case TGSI_TEXTURE_SHADOW2D: *is_shad = 1; return "2DShadow"; + case TGSI_TEXTURE_SHADOW2D: return "2DShadow"; case TGSI_TEXTURE_SHADOWRECT: - *is_shad = 1; return (!use_gles) ? "2DRectShadow" : "2DShadow"; case TGSI_TEXTURE_1D_ARRAY: if (!use_gles) @@ -5377,14 +5375,13 @@ const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type, int *i case TGSI_TEXTURE_2D_ARRAY: return "2DArray"; case TGSI_TEXTURE_SHADOW1D_ARRAY: if (!use_gles) { - *is_shad = 1; return "1DArrayShadow"; } /* fallthrough */ - case TGSI_TEXTURE_SHADOW2D_ARRAY: *is_shad = 1; return "2DArrayShadow"; - case TGSI_TEXTURE_SHADOWCUBE: *is_shad = 1; return "CubeShadow"; + case TGSI_TEXTURE_SHADOW2D_ARRAY: return "2DArrayShadow"; + case TGSI_TEXTURE_SHADOWCUBE: return "CubeShadow"; case TGSI_TEXTURE_CUBE_ARRAY: return "CubeArray"; - case TGSI_TEXTURE_SHADOWCUBE_ARRAY: *is_shad = 1; return "CubeArrayShadow"; + case TGSI_TEXTURE_SHADOWCUBE_ARRAY: return "CubeArrayShadow"; case TGSI_TEXTURE_2D_MSAA: return "2DMS"; case TGSI_TEXTURE_2D_ARRAY_MSAA: return "2DMSArray"; default: return NULL; @@ -5430,7 +5427,7 @@ static void emit_sampler_decl(struct dump_ctx *ctx, const struct vrend_shader_sampler *sampler) { char ptc; - int is_shad = 0; + bool is_shad; const char *sname, *precision, *stc; sname = tgsi_proc_to_prefix(ctx->prog_type); @@ -5438,7 +5435,8 @@ static void emit_sampler_decl(struct dump_ctx *ctx, precision = (ctx->cfg->use_gles) ? "highp " : " "; ptc = vrend_shader_samplerreturnconv(sampler->tgsi_sampler_return); - stc = vrend_shader_samplertypeconv(ctx->cfg->use_gles, sampler->tgsi_sampler_type, &is_shad); + stc = vrend_shader_samplertypeconv(ctx->cfg->use_gles, sampler->tgsi_sampler_type); + is_shad = samplertype_is_shadow(sampler->tgsi_sampler_type); /* GLES does not support 1D textures -- we use a 2D texture and set the parameter set to 0.5 */ if (ctx->cfg->use_gles && sampler->tgsi_sampler_type == TGSI_TEXTURE_1D) @@ -5590,7 +5588,6 @@ static void emit_image_decl(struct dump_ctx *ctx, const struct vrend_shader_image *image) { char ptc; - int is_shad = 0; const char *sname, *stc, *formatstr; enum tgsi_return_type itype; const char *volatile_str = image->vflag ? "volatile " : ""; @@ -5599,7 +5596,7 @@ static void emit_image_decl(struct dump_ctx *ctx, formatstr = get_internalformat_string(image->decl.Format, &itype); ptc = vrend_shader_samplerreturnconv(itype); sname = tgsi_proc_to_prefix(ctx->prog_type); - stc = vrend_shader_samplertypeconv(ctx->cfg->use_gles, image->decl.Resource, &is_shad); + stc = vrend_shader_samplertypeconv(ctx->cfg->use_gles, image->decl.Resource); if (!image->decl.Writable) access = "readonly "; diff --git a/src/vrend_shader.h b/src/vrend_shader.h index 8f7cc96..07ab19d 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -160,7 +160,7 @@ bool vrend_convert_shader(struct vrend_context *rctx, struct vrend_shader_info *sinfo, struct vrend_strarray *shader); -const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type, int *is_shad); +const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type); char vrend_shader_samplerreturnconv(enum tgsi_return_type type);