- Home /
Cannot use unity_ObjectToWorld on the GPU Adreno 505?
Update: For some of our other dev-kit:
Adreno 430: Not work.
Adreno 305: Works fine.
We are currently testing our project on our dev-kits, one of which is Adreno 505.
And it confuses us a lot that whenever we use unity_ObjectToWorld in our fragment shader, there comes an error and the fragment would not be rendered.
We use snapdragon profiler to test our shader, and the glsl is like this:
This is vertex shader converted to glsl:
#version 300 es
uniform vec4 hlslcc_mtx4x4unity_ObjectToWorld[4];
uniform vec4 hlslcc_mtx4x4unity_MatrixVP[4];
in highp vec4 in_POSITION0;
in highp vec2 in_TEXCOORD0;
out highp vec2 vs_TEXCOORD0;
vec4 u_xlat0;
vec4 u_xlat1;
void main()
{
u_xlat0 = in_POSITION0.yyyy * hlslcc_mtx4x4unity_ObjectToWorld[1];
u_xlat0 = hlslcc_mtx4x4unity_ObjectToWorld[0] * in_POSITION0.xxxx + u_xlat0;
u_xlat0 = hlslcc_mtx4x4unity_ObjectToWorld[2] * in_POSITION0.zzzz + u_xlat0;
u_xlat0 = u_xlat0 + hlslcc_mtx4x4unity_ObjectToWorld[3];
u_xlat1 = u_xlat0.yyyy * hlslcc_mtx4x4unity_MatrixVP[1];
u_xlat1 = hlslcc_mtx4x4unity_MatrixVP[0] * u_xlat0.xxxx + u_xlat1;
u_xlat1 = hlslcc_mtx4x4unity_MatrixVP[2] * u_xlat0.zzzz + u_xlat1;
gl_Position = hlslcc_mtx4x4unity_MatrixVP[3] * u_xlat0.wwww + u_xlat1;
vs_TEXCOORD0.xy = in_TEXCOORD0.xy;
return;
}
This is the fragment shader:
#version 300 es
precision highp float;
precision highp int;
uniform vec4 hlslcc_mtx4x4unity_ObjectToWorld[4];
layout(location = 0) out mediump vec4 SV_Target0;
void main()
{
/////
// Red: works fine.
// Not render: something wrong about hlslcc_mtx4x4unity_ObjectToWorld
SV_Target0 = hlslcc_mtx4x4unity_ObjectToWorld[2];
SV_Target0 = vec4(1,0,0,1);
return;
//////////
}
It works fine on Mali GPUs, but it failes to render when it comes to Adreno 505.
How to handle that please?
Comment