[virglrenderer-devel] [PATCH virglrenderer] shader: fix Unigine Heaven 4.0 shader translation
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Wed Sep 7 18:48:52 UTC 2016
From: Marc-André Lureau <marcandre.lureau at redhat.com>
The benchmark fails to start, the translation of gl_Identity is incorrect,
UMAD TEMP[0], SV[0].xxxx, TEMP[0].xxxx, TEMP[1]
is translated to:
temp0[0] = vec4(uintBitsToFloat((gl_InstanceID * floatBitsToUint(temp0[0].xxxx) + floatBitsToUint(temp0[1]))));
Which results in the following error:
shader failed to compile
0:23(34): error: could not implicitly convert operands to arithmetic operator
0:23(34): error: operands to arithmetic operators must be numeric
0:23(17): error: no matching function for call to `uintBitsToFloat(error)'; candidates are:
It seems we can use the same workaround as gl_VertexID, I didn't
observe any regression running various gl_InstanceId tests from
piglit:
temp0[0] = vec4(uintBitsToFloat((floatBitsToUint(vec4(intBitsToFloat(gl_InstanceID))) * floatBitsToUint(temp0[0].xxxx) + floatBitsToUint(temp0[1]))));
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/vrend_shader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 0350b12..a80c3f1 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -1632,7 +1632,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
} else if (src->Register.File == TGSI_FILE_SYSTEM_VALUE) {
for (j = 0; j < ctx->num_system_values; j++)
if (ctx->system_values[j].first == src->Register.Index) {
- if (ctx->system_values[j].name == TGSI_SEMANTIC_VERTEXID)
+ if (ctx->system_values[j].name == TGSI_SEMANTIC_VERTEXID || ctx->system_values[j].name == TGSI_SEMANTIC_INSTANCEID)
snprintf(srcs[i], 255, "%s(vec4(intBitsToFloat(%s)))", stypeprefix, ctx->system_values[j].glsl_name);
else
snprintf(srcs[i], 255, "%s%s", prefix, ctx->system_values[j].glsl_name);
--
2.10.0
More information about the virglrenderer-devel
mailing list