- October 24, 2013 at 5:52 pm #31526
I’m trying to reduce the size of one of my PFX files that’s getting a little too large to manage, so I thought I’d put the shader code in separate text files and include them.
I’ve checked the PFX specification and it seems you include them like this:
Here’s the full listing of the PFX if it helps
DESCRIPTION Moon shaders
// GLOBALS UNIFORMS
UNIFORM WorldViewIT WORLDVIEWIT
UNIFORM WVPMatrix WORLDVIEWPROJECTION
UNIFORM LightDirection LIGHTDIREYE
UNIFORM sMoon TEXTURE0
ATTRIBUTE inVertex POSITION
ATTRIBUTE inNormal NORMAL
ATTRIBUTE inTexCoord UV
TEXTURE 0 moon
Then in the plain text files I have this for the Vertex Shader:
attribute highp vec4 inVertex;
attribute mediump vec3 inNormal;
attribute mediump vec2 inTexCoord;
uniform highp mat4 WVPMatrix;
uniform mediump mat3 WorldViewIT;
uniform mediump vec3 LightDirection;
varying mediump vec2 TexCoord;
gl_Position = WVPMatrix * inVertex;
mediump vec3 transNormal = normalize(WorldViewIT * inNormal);
TexCoord = inTexCoord;
And for the Fragment Shader:
uniform sampler2D sMoon;
varying mediump vec2 TexCoord;
gl_FragColor.rgb = texture2D(sMoon, TexCoord).rgb;
gl_FragColor.a = 1.0;
Unfortunately I get an error in PVRShaderEditor saying:
Error while parsing PFX: Error loading file 'moon.vsh' in [VERTEXSHADER] on line 18
The PFX and the shader files are in the same directory, so I can’t see what the problem is.
Am I missing something?
Andre.October 25, 2013 at 11:15 am #38156
You’ve found a legitimate bug in PVRShaderEditor. The current working directory is not been correctly set up before the PFX is parsed, hence the problem. A nasty work-around would be to place the shader files with the PVRShaderEditor executable, but obviously this is an awful solution.
I’ve filed bug report BRN45433, and as this is a feature-breaking bug it should be fixed fairly quickly.
Regards.October 25, 2013 at 12:52 pm #38157
Thanks for the fast response. I’ll hold off on refactoring my PFX files in this way until the fix.
Andre.November 1, 2013 at 2:26 pm #38158
You’ll be pleased to know that the fix made it into our 3.2 release, which went public yesterday.
Hopefully this should fix your problem.
Regards.November 2, 2013 at 12:41 am #38159
That’s great. I’ll check it out on monday 🙂
Andre.November 4, 2013 at 5:48 pm #38160
I’ve installed the latest SDK and Tools and the PVRShaderEditor is now happy with external shader files, and compiles the PFX without any issues 🙂
However, having the shader code in external files causes a material using this PFX to fail in PVRShaman 🙁
Andre.November 20, 2013 at 1:05 pm #38161
Has anyone been able to replicate my problem with PVRShaman I mentioned above?
Andre.December 11, 2013 at 3:04 pm #38162
Apologies – I completely missed this thread! I’ve reproduced the problem you’ve described and I’m investigating it now.December 11, 2013 at 3:14 pm #38163December 11, 2013 at 3:19 pm #38164
Thanks for your response. I’m working on a different part of the system at present so it is not blocking my work at present. When is the next PVRShaman/PVRSDK release scheduled?
Andre.December 12, 2013 at 11:16 am #38165
SDK 3.3 is due around late February 2014 but we can update individual utilities before this date if we find a major issue.February 3, 2014 at 12:02 pm #38166
I’m back working within PVRShaman now, and having the issue I mentioned in this thread above.
Do you have a fixed version of PVRShaman you could give me so I can edit PFX’s which reference external shader sources?