Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

HLSL missing declarations?

$
0
0

@reiti.net wrote:

I have made a - basic - shader in HLSL which runs fine in DX but throws compilation errors in OpenGL:

ERROR: 0:47: 'ps_v4' : undeclared identifier 
ERROR: 0:47: 'xyz' :  field selection requires structure, vector, or matrix on left hand side 
ERROR: 0:48: 'ps_v3' : undeclared identifier 
ERROR: 0:48: 'xyz' :  field selection requires structure, vector, or matrix on left hand side 
ERROR: 0:70: 'ps_v5' : undeclared identifier 
ERROR: 0:70: 'xxxx' :  field selection requires structure, vector, or matrix on left hand side

I don't know much about GLSL, but I did look into the generated .xnb files and indeed, the declarations are missing:

...
...
uniform sampler2D ps_s0;
uniform sampler2D ps_s1;
varying vec4 vTexCoord0;
#define ps_v0 vTexCoord0
#define ps_oC0 gl_FragColor
varying vec4 vTexCoord1;
#define ps_v1 vTexCoord1
varying vec4 vFrontColor;
#define ps_v2 vFrontColor

void main()
...
...
ps_r1 = (ps_r1.xyzx * ps_c12.wwwz) + ps_c12.zzzw;
ps_r0 = clamp(ps_r0 * ps_r1, vec4(0.0), vec4(1.0));
ps_oC0 = mix(ps_c12.zzzw, ps_r0, ps_v5.xxxx);
...

but they are used in the same file.

Can someone help me find out, what exactly could be the problem, so MGCP is building that file wrong?
There is no error in MGCP, just warnings about implicit vector truncations.

The whole shadercode may be a bit wrong, but it's not so unusal, but is using Tangent/Binormal for bumpmapping:

struct VSI
{
	float4 Position : POSITION0;
	float4 Normal : NORMAL0;
	float2 UV : TEXCOORD0;
	float4 Color : COLOR0;
	float3 Tangent : TANGENT;
	float3 Binormal : BINORMAL;
};

Any ideas?

Posts: 7

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles