[virglrenderer-devel] [PATCH virglrenderer] shader: fix Unigine Heaven 4.0 shader translation
Chen Fan
fan.chen at easystack.cn
Wed Sep 14 07:42:56 UTC 2016
Hi,
I note that this patch has been upstream. :). Thanks
On 2016年09月14日 14:21, Chen Fan wrote:
> Hi Marc,
>
> Sorry for the late reply, this patch works fine on my
> environment, Thanks for your effort,
>
> So it can be added:
>
> Tested-by: Chen Fan <fan.chen at easystack.cn>
>
>
> Thanks,
>
> On 2016年09月08日 02:02, 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);
>>
>> 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);
>
--
Sincerely,
Chen Fan
More information about the virglrenderer-devel
mailing list