[virglrenderer-devel] [PATCH 2/2] vrend_shader: use emit_sampler_declaration helper
Gurchetan Singh
gurchetansingh at chromium.org
Fri Jun 29 03:31:27 UTC 2018
Fixes a bunch of non-compute related dEQP-GLES31.functional.shaders.opaque_type_indexing.*
tests.
Example test cases:
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.vertex.sampler2dshadow
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.dynamically_uniform.tessellation_control.samplercubearrayshadow
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.dynamically_uniform.tessellation_evaluation.samplercubearrayshadow
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.geometry.sampler2dshadow
---
src/vrend_shader.c | 48 +++++-----------------------------------------
1 file changed, 5 insertions(+), 43 deletions(-)
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index f0dc49cbbf..0cb9dae64e 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -3824,57 +3824,19 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
if (ctx->info.indirect_files & (1 << TGSI_FILE_SAMPLER)) {
for (i = 0; i < ctx->num_sampler_arrays; i++) {
- int is_shad = 0;
- const char *stc;
- stc = vrend_shader_samplertypeconv(ctx->sampler_arrays[i].sview_type, &is_shad);
- if (!stc)
- continue;
- snprintf(buf, 255, "uniform %csampler%s %ssamp%d[%d];\n",
- get_return_type_prefix(ctx->sampler_arrays[i].sview_rtype),
- stc, sname, ctx->sampler_arrays[i].idx,
- ctx->sampler_arrays[i].last - ctx->sampler_arrays[i].first);
- STRCAT_WITH_RET(glsl_hdr, buf);
+ uint32_t range = ctx->sampler_arrays[i].last - ctx->sampler_arrays[i].first;
+ emit_sampler_declaration(ctx, glsl_hdr, i, range, ctx->sampler_arrays[i].sview_type,
+ ctx->sampler_arrays[i].sview_rtype);
}
} else {
nsamp = util_last_bit(ctx->samplers_used);
for (i = 0; i < nsamp; i++) {
- int is_shad = 0;
- const char *stc;
- char ptc;
if ((ctx->samplers_used & (1 << i)) == 0)
continue;
- const char *sname;
- const char *precision;
-
- ptc = vrend_shader_samplerreturnconv(ctx->samplers[i].tgsi_sampler_return);
- stc = vrend_shader_samplertypeconv(ctx->samplers[i].tgsi_sampler_type, &is_shad);
-
- sname = tgsi_proc_to_prefix(ctx->prog_type);
-
- if (ctx->cfg->use_gles) {
- precision = "highp ";
- } else {
- precision = " ";
- }
-
- /* OpenGL ES do not support 1D texture
- * so we use a 2D texture with a parameter set to 0.5
- */
- if (ctx->cfg->use_gles && !strcmp(stc, "1D"))
- snprintf(buf, 255, "uniform %csampler2D %ssamp%d;\n", ptc, sname, i);
- else
- snprintf(buf, 255, "uniform %s%csampler%s %ssamp%d;\n", precision, ptc, stc, sname, i);
-
- STRCAT_WITH_RET(glsl_hdr, buf);
- if (is_shad) {
- snprintf(buf, 255, "uniform %svec4 %sshadmask%d;\n", precision, sname, i);
- STRCAT_WITH_RET(glsl_hdr, buf);
- snprintf(buf, 255, "uniform %svec4 %sshadadd%d;\n", precision, sname, i);
- STRCAT_WITH_RET(glsl_hdr, buf);
- ctx->shadow_samp_mask |= (1 << i);
- }
+ emit_sampler_declaration(ctx, glsl_hdr, i, 0, ctx->samplers[i].tgsi_sampler_type,
+ ctx->samplers[i].tgsi_sampler_return);
}
}
if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT &&
--
2.18.0.rc2.346.g013aa6912e-goog
More information about the virglrenderer-devel
mailing list