Hi to all,
i'm try to port an application from osx opengl 2 to linux with mesa 7
support.
This is my custom shader ( from http://www.fourcc.org/ )
const GLcharARB *FProgram=
"#extension GL_ARB_texture_rectangle :
enable\n"
"uniform sampler2DRect Ytex;\n"
"uniform sampler2DRect Utex,Vtex;\n"
"uniform float Ysize;\n"
"void main(void) {\n"
" float nx,ny,r,g,b,y,u,v;\n"
" vec4 txl,ux,vx;"
" nx=gl_TexCoord[0].x;\n"
" ny=Ysize-gl_TexCoord[0].y;\n"
"
y=texture2DRect(Ytex,vec2(nx,ny)).r;\n"
"
u=texture2DRect(Utex,vec2(nx/2.0,ny/2.0)).r;\n"
"
v=texture2DRect(Vtex,vec2(nx/2.0,ny/2.0)).r;\n"
" y=1.1643*(y-0.0625);\n"
" u=u-0.5;\n"
" v=v-0.5;\n"
" r=y+1.5958*v;\n"
" g=y-0.39173*u-0.81290*v;\n"
" b=y+2.017*u;\n"
" gl_FragColor=vec4(r,g,b,1.0);\n"
"}\n";
/* Set up program objects. */
PHandle = glCreateProgram();
FSHandle = glCreateShader( GL_FRAGMENT_SHADER );
/* Compile the shader. */
glShaderSource( FSHandle, 1, &FProgram, NULL );
glCompileShader( FSHandle );
/* Print the compilation log. */
{
GLint i;
char *s;
glGetShaderiv( FSHandle, GL_COMPILE_STATUS, &i);
if ( i == 0 ) {
s = (char*)malloc( 32768 );
glGetShaderInfoLog( FSHandle, 32768, NULL, s );
wxString errStr( s, wxConvLibc );
wxLogError( wxT( "Compiler log:\n%s" ), errStr.c_str()
);
free(s);
}
else wxLogDebug( wxT( "Shader succesfully compiled." ) );
}
/* Create a complete program object. */
glAttachShader( PHandle, FSHandle );
glLinkProgram( PHandle );
/* And print the link log. */
{
GLint i;
char *s;
glGetProgramiv( PHandle, GL_LINK_STATUS, &i );
if ( i == 0 ) {
s = (char*)malloc( 32768 );
glGetProgramInfoLog( PHandle, 32768, NULL, s );
wxString errStr( s, wxConvLibc );
wxLogError( wxT( "Linker log:\n%s" ), errStr.c_str() );
free(s);
}
else wxLogDebug( wxT( "Shader succesfully linked." ) );
}
When I try to execute this code on linux with mesa 7 and nvidia card
i obtain the next output
[Debug] 10:24:00: Shader succesfully compiled.
[Debug] 10:24:00: Linker log:
Fragment info
-------------
Internal error: assembly compile error for fragment shader at offset
953:
-- error message --
line 29, column 16: error: expected '}'
-- internal assembly text --
!!ARBfp1.0
OPTION NV_fragment_program2;
# cgc version 1.6.0011, build date Nov 9 2006 18:10:56
# command line args:
#vendor NVIDIA Corporation
#version 1.6.0.11
#profile fp40
#program main
#semantic Ytex
#semantic Utex
#semantic Vtex
#semantic Ysize
#var float4 gl_TexCoord[0] : $vin.TEX0 : TEX0 : -1 : 1
#var float4 gl_TexCoord[1] : : : -1 : 0
#var float4 gl_TexCoord[2] : : : -1 : 0
#var float4 gl_TexCoord[3] : : : -1 : 0
#var float4 gl_TexCoord[4] : : : -1 : 0
#var float4 gl_TexCoord[5] : : : -1 : 0
#var float4 gl_TexCoord[6] : : : -1 : 0
#var float4 gl_TexCoord[7] : : : -1 : 0
#var float4 gl_FragColor : $vout.COLOR : COL : -1 : 1
#var samplerRECT Ytex : : texunit 0 : -1 : 1
#var samplerRECT Utex : : texunit 1 : -1 : 1
#var samplerRECT Vtex : : texunit 2 : -1 : 1
#var float Ysize : : c[0] : -1 : 1
#const c[1] = 0,5 1,1643 0,0625 1,5958
#const c[2] = 0,39173 0,8129 2,017 1
PARAM c[3] = { program.local[0],
{ 0,5, 1,1643, 0,0625, 1,5958 },
{ 0,39173001, 0,81290001, 2,017, 1 } };
TEMP R0;
TEMP R1;
TEMP RC;
TEMP HC;
OUTPUT oCol = result.color;
ADDR R0.y, -fragment.texcoord[0], c[0].x;
MULR R0.w, R0.y, c[1].x;
MULR R0.z, fragment.texcoord[0].x, c[1].x;
TEX R0.x, R0.zwzw, texture[2], RECT;
MOVR R1.y, R0;
ADDR R0.y, R0.x, -c[1].x;
TEX R0.x, R0.zwzw, texture[1], RECT;
MOVR R1.x, fragment.texcoord[0];
TEX R1.x, R1, texture[0], RECT;
ADDR R1.x, R1, -c[1].z;
MULR R0.z, R1.x, c[1].y;
ADDR R0.x, R0, -c[1];
MADR R0.w, -R0.x, c[2].x, R0.z;
MADR oCol.x, R0.y, c[1].w, R0.z;
MADR oCol.y, -R0, c[2], R0.w;
MADR oCol.z, R0.x, c[2], R0;
MOVR oCol.w, c[2];
END
# 17 instructions, 2 R-regs, 0 H-regs
Why the generated assembly code generate this error?
Thanks in advance
Sandro-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev