[virglrenderer-devel] [PATCH virglrenderer] shader: fix Unigine Heaven 4.0 shader translation

Marc-André Lureau marcandre.lureau at gmail.com
Wed Sep 7 18:14:10 UTC 2016


Hi

On Wed, Sep 7, 2016 at 10:02 PM <marcandre.lureau at redhat.com> wrote:

> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> The benchmark fails to start, the translation of gl_Identity is incorrect,
>
> UMUL TEMP[0].x, SV[0].xxxx, IMM[0].xxxx
>
> 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].x =
> float(uintBitsToFloat((uvec4(floatBitsToUint(vec4(intBitsToFloat(gl_InstanceID))))
> * uvec4(uvec4(ivec4(3,3,3,3))))).x);
>

wrong examples, I got confused by the various dumps, trying to find the
right ones.


>
> 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
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
>
-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/virglrenderer-devel/attachments/20160907/360b7621/attachment.html>


More information about the virglrenderer-devel mailing list