Closed kas1e closed 6 years ago
This is a problem with gl4es, the shader generated by fpe_shader.c
for double side lighting seems wrong.
I'll fix that.
Checked latest commit, still same:
LIBGL: FPE Vertex shader compile failed: ERROR: Code generation failed. Error log: INTERNAL ERROR: Variable is missing its CGVars: 152: OpLoad: FloatVector3: tmp152 << back_ss INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: (Vector/Matrix)TimesScalar instruction's source parameters are missing INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: Dot instruction's source parameters are missing INTERNAL ERROR: Store instruction's source parameter is incomplete: OpStore: : tmp159 >> BackColor INTERNAL ERROR: Variable is missing its CGVars: 245: OpLoad: FloatVector3: tmp245 << back_ss INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: (Vector/Matrix)TimesScalar instruction's source parameters are missing INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: Dot instruction's source parameters are missing INTERNAL ERROR: Store instruction's source parameter is incomplete:
glCreateShader(GL_FRAGMENT_SHADER) glShaderSource(257, 1, 0x6af51f00, 0x0) Shader source// FPE_Shader generated // Fragment Shader // lighting=1, alpha=0, secondary=0, planes=000000, texture=00000000, texformat=00000000 point=0 varying vec4 Color; varying vec4 BackColor; void main() { vec4 fColor = (gl_FrontFacing)?Color:BackColor; gl_FragColor = fColor; }: (FPEShader generated) New Shader source:
precision mediump float; precision mediump int; // FPE_Shader generated // Fragment Shader // lighting=1, alpha=0, secondary=0, planes=000000, texture=00000000, texformat=00000000 point=0 varying vec4 Color; varying vec4 BackColor; void main() { vec4 fColor = (gl_FrontFacing)?Color:BackColor; gl_FragColor = fColor; } glCompileShader(257) glGetShaderiv(257, 0x8B81, 0x65e4e4b4) glGetShaderInfoLog(257, 1000, 0x0, 0x65e4e4b8) LIBGL: FPE Fragment shader compile failed: ERROR: Code generation failed. Error log: Loading from built-in variables is unsupported: offset: unset, size: 1, Bool gl_FrontFacing BuiltIn(FrontFacing) INTERNAL ERROR: CompositeConstruct instruction is incomplete: 20: OpCompositeConstruct: BoolVector4: tmp20 << tmp13, tmp13, tmp13, tmp13 INTERNAL ERROR: CompositeConstruct instruction is incomplete: 20: OpCompositeConstruct: BoolVector4: tmp20 << tmp13, tmp13, tmp13, tmp13 INTERNAL ERROR: CompositeConstruct instruction is incomplete: 20: OpCompositeConstruct: BoolVector4: tmp20 << tmp13, tmp13, tmp13, tmp13 INTERNAL ERROR: CompositeConstruct instruction is incomplete: 20: OpCompositeConstruct: BoolVector4: tmp20 << tmp13, tmp13, tmp13, tmp13 OpSelect instruction isn't implemented yet. INTERNAL ERROR: Store instruction's source parameter is incomplete: OpStore: : tmp21 >> gl_FragColor
Ah, it's another issue. This time, it's an issue in shaderconv.c
that hasn't translate gl_FrontFacing
... I'll fix that soon.
And the error in vertex shader still remain the same (i.e. not only frament one fail because of gl_FrontFacing, but vertex one fail the same as before fix. But probably its all related together :)
Mmmm, in fact, the OGLES2 drivers should allow the use of gl_FrontFacing
. This built-in exist in OpenGLES2, I don't see any reason to reject the shader.
Strange, even with latest commits i have 1:1 the same errors as before.
Is that example works for you ?
I will try for now to compile shaders manually via our internal-shader-compiler-checker
Yeah, the example works for me.
Vertex shader is
#version 100
precision mediump float;
precision mediump int;
uniform highp mat4 _gl4es_ModelViewProjectionMatrix;
uniform highp mat3 _gl4es_NormalMatrix;
attribute highp vec4 _gl4es_Vertex;
attribute highp vec3 _gl4es_Normal;
struct _gl4es_LightModelProducts
{
vec4 sceneColor;
};
uniform _gl4es_LightModelProducts _gl4es_FrontLightModelProduct;
uniform _gl4es_LightModelProducts _gl4es_BackLightModelProduct;
// FPE_Shader generated
// ** Vertex Shader **
// ligthting=1 (twosided=1, separate=0, color_material=0)
// secondary=0, planes=000000
// texture=00000000, point=0
varying vec4 Color;
struct _gl4es_FPELightSourceParameters1
{
highp vec4 specular;
highp vec4 position;
highp vec3 spotDirection;
highp float spotExponent;
highp float spotCosCutoff;
highp float constantAttenuation;
highp float linearAttenuation;
highp float quadraticAttenuation;
};
struct _gl4es_FPELightSourceParameters0
{
highp vec4 specular;
highp vec4 position;
highp vec3 spotDirection;
highp float spotExponent;
highp float spotCosCutoff;
};
struct _gl4es_LightProducts
{
highp vec4 ambient;
highp vec4 diffuse;
highp vec4 specular;
};
uniform highp float _gl4es_FrontMaterial_shininess;
uniform highp float _gl4es_FrontMaterial_alpha;
uniform highp float _gl4es_BackMaterial_shininess;
uniform highp float _gl4es_BackMaterial_alpha;
uniform _gl4es_FPELightSourceParameters0 _gl4es_LightSource_0;
uniform _gl4es_LightProducts _gl4es_FrontLightProduct_0;
uniform _gl4es_LightProducts _gl4es_BackLightProduct_0;
uniform _gl4es_FPELightSourceParameters0 _gl4es_LightSource_1;
uniform _gl4es_LightProducts _gl4es_FrontLightProduct_1;
uniform _gl4es_LightProducts _gl4es_BackLightProduct_1;
varying vec4 BackColor;
void main() {
vec3 normal = normalize(_gl4es_NormalMatrix * _gl4es_Normal);
gl_Position = _gl4es_ModelViewProjectionMatrix * _gl4es_Vertex;
// ColorMaterial On/Off=0 Front = 0 Back = 0
Color = _gl4es_FrontLightModelProduct.sceneColor;
BackColor = _gl4es_BackLightModelProduct.sceneColor;
highp float att;
highp float spot;
highp vec3 VP;
highp float lVP;
highp float nVP;
highp vec3 aa,dd,ss;
highp vec3 hi;
highp vec3 back_aa,back_dd,back_ss;
// light 0 on, light_direction=0, light_cutoff180=0
att = 1.0;
VP = normalize(_gl4es_LightSource_0.position.xyz);
aa = _gl4es_FrontLightProduct_0.ambient.xyz;
back_aa = _gl4es_BackLightProduct_0.ambient.xyz;
nVP = dot(normal, VP);
dd = nVP * _gl4es_FrontLightProduct_0.diffuse.xyz*step(0.0, nVP);
back_dd = -nVP * _gl4es_BackLightProduct_0.diffuse.xyz * step(0.0, -nVP);
hi = normalize(VP + vec3(0., 0., 1.));
lVP = dot(normal, hi);
ss = (pow(lVP, _gl4es_FrontMaterial_shininess)*_gl4es_FrontLightProduct_0.specular.xyz)*step(0.0, nVP)*step(0.0, lVP);
ss = (pow(-lVP, _gl4es_BackMaterial_shininess)*_gl4es_BackLightProduct_0.specular.xyz)*step(0.0, -nVP)*step(0.0, -lVP);
Color.rgb += att*(aa+dd+ss);
BackColor.rgb += att*(back_aa+back_dd+back_ss);
// end of light 0
// light 1 on, light_direction=0, light_cutoff180=0
att = 1.0;
VP = normalize(_gl4es_LightSource_1.position.xyz);
aa = _gl4es_FrontLightProduct_1.ambient.xyz;
back_aa = _gl4es_BackLightProduct_1.ambient.xyz;
nVP = dot(normal, VP);
dd = nVP * _gl4es_FrontLightProduct_1.diffuse.xyz*step(0.0, nVP);
back_dd = -nVP * _gl4es_BackLightProduct_1.diffuse.xyz * step(0.0, -nVP);
hi = normalize(VP + vec3(0., 0., 1.));
lVP = dot(normal, hi);
ss = (pow(lVP, _gl4es_FrontMaterial_shininess)*_gl4es_FrontLightProduct_1.specular.xyz)*step(0.0, nVP)*step(0.0, lVP);
ss = (pow(-lVP, _gl4es_BackMaterial_shininess)*_gl4es_BackLightProduct_1.specular.xyz)*step(0.0, -nVP)*step(0.0, -lVP);
Color.rgb += att*(aa+dd+ss);
BackColor.rgb += att*(back_aa+back_dd+back_ss);
// end of light 1
Color.a = _gl4es_FrontMaterial_alpha;
Color.rgb = clamp(Color.rgb, 0., 1.);
BackColor.rgb = clamp(BackColor.rgb, 0., 1.);
BackColor.a = _gl4es_BackMaterial_alpha;
// texturing
}
and Fragmen is
#version 100
precision mediump float;
precision mediump int;
// FPE_Shader generated
// ** Fragment Shader **
// lighting=1, alpha=0, secondary=0, planes=000000, texture=00000000, texformat=00000000 point=0
varying vec4 Color;
varying vec4 BackColor;
void main() {
vec4 fColor = (gl_FrontFacing)?Color:BackColor;
gl_FragColor = fColor;
}
Ok, seems our shader's compiler have another limitations.. That what i have when trying to compile fragment shader:
W3DNShaderInfo - Get shader information
Shader: frag.spv Compiling frag.spv failed (23) with error: shader compilation failed due to errors Log: ERROR: Code generation failed. Error log: Loading from built-in variables is unsupported: offset: unset, size: 1, Bool gl_FrontFacing BuiltIn(FrontFacing) INTERNAL ERROR: OpBranchConditional instruction's source parameters are missing
And that what i have when compile Vertex shader:
W3DNShaderInfo - Get shader information
Shader: vert.spv Compiling vert.spv failed (23) with error: shader compilation failed due to errors Log: ERROR: Code generation failed. Error log: INTERNAL ERROR: Variable is missing its CGVars: 152: OpLoad: FloatVector3: tmp152 << back_ss INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: (Vector/Matrix)TimesScalar instruction's source parameters are missing INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: Dot instruction's source parameters are missing INTERNAL ERROR: Store instruction's source parameter is incomplete: OpStore: : tmp159 >> BackColor INTERNAL ERROR: Variable is missing its CGVars: 245: OpLoad: FloatVector3: tmp245 << back_ss INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: (Vector/Matrix)TimesScalar instruction's source parameters are missing INTERNAL ERROR: I/FAdd instruction's source parameters are missing INTERNAL ERROR: Dot instruction's source parameters are missing INTERNAL ERROR: Store instruction's source parameter is incomplete: OpStore: : tmp252 >> BackColor
Seems another 2 bug reports, but at this time to the Warp3D's shader's compiler ?
Wait, why I don't back_ss
and still see ss
on that shader.
New vertex shader:
#version 100
precision mediump float;
precision mediump int;
uniform highp mat4 _gl4es_ModelViewProjectionMatrix;
uniform highp mat3 _gl4es_NormalMatrix;
attribute highp vec4 _gl4es_Vertex;
attribute highp vec3 _gl4es_Normal;
struct _gl4es_LightModelProducts
{
vec4 sceneColor;
};
uniform _gl4es_LightModelProducts _gl4es_FrontLightModelProduct;
uniform _gl4es_LightModelProducts _gl4es_BackLightModelProduct;
// FPE_Shader generated
// ** Vertex Shader **
// ligthting=1 (twosided=1, separate=0, color_material=0)
// secondary=0, planes=000000
// texture=00000000, point=0
varying vec4 Color;
struct _gl4es_FPELightSourceParameters1
{
highp vec4 specular;
highp vec4 position;
highp vec3 spotDirection;
highp float spotExponent;
highp float spotCosCutoff;
highp float constantAttenuation;
highp float linearAttenuation;
highp float quadraticAttenuation;
};
struct _gl4es_FPELightSourceParameters0
{
highp vec4 specular;
highp vec4 position;
highp vec3 spotDirection;
highp float spotExponent;
highp float spotCosCutoff;
};
struct _gl4es_LightProducts
{
highp vec4 ambient;
highp vec4 diffuse;
highp vec4 specular;
};
uniform highp float _gl4es_FrontMaterial_shininess;
uniform highp float _gl4es_FrontMaterial_alpha;
uniform highp float _gl4es_BackMaterial_shininess;
uniform highp float _gl4es_BackMaterial_alpha;
uniform _gl4es_FPELightSourceParameters0 _gl4es_LightSource_0;
uniform _gl4es_LightProducts _gl4es_FrontLightProduct_0;
uniform _gl4es_LightProducts _gl4es_BackLightProduct_0;
uniform _gl4es_FPELightSourceParameters0 _gl4es_LightSource_1;
uniform _gl4es_LightProducts _gl4es_FrontLightProduct_1;
uniform _gl4es_LightProducts _gl4es_BackLightProduct_1;
varying vec4 BackColor;
void main() {
vec3 normal = normalize(_gl4es_NormalMatrix * _gl4es_Normal);
gl_Position = _gl4es_ModelViewProjectionMatrix * _gl4es_Vertex;
// ColorMaterial On/Off=0 Front = 0 Back = 0
Color = _gl4es_FrontLightModelProduct.sceneColor;
BackColor = _gl4es_BackLightModelProduct.sceneColor;
highp float att;
highp float spot;
highp vec3 VP;
highp float lVP;
highp float nVP;
highp vec3 aa,dd,ss;
highp vec3 hi;
highp vec3 back_aa,back_dd,back_ss;
// light 0 on, light_direction=0, light_cutoff180=0
att = 1.0;
VP = normalize(_gl4es_LightSource_0.position.xyz);
aa = _gl4es_FrontLightProduct_0.ambient.xyz;
back_aa = _gl4es_BackLightProduct_0.ambient.xyz;
nVP = dot(normal, VP);
dd = nVP * _gl4es_FrontLightProduct_0.diffuse.xyz*step(0.0, nVP);
back_dd = -nVP * _gl4es_BackLightProduct_0.diffuse.xyz * step(0.0, -nVP);
hi = normalize(VP + vec3(0., 0., 1.));
lVP = dot(normal, hi);
ss = (pow(lVP, _gl4es_FrontMaterial_shininess)*_gl4es_FrontLightProduct_0.specular.xyz)*step(0.0, nVP)*step(0.0, lVP);
back_ss = (pow(-lVP, _gl4es_BackMaterial_shininess)*_gl4es_BackLightProduct_0.specular.xyz)*step(0.0, -nVP)*step(0.0, -lVP);
Color.rgb += att*(aa+dd+ss);
BackColor.rgb += att*(back_aa+back_dd+back_ss);
// end of light 0
// light 1 on, light_direction=0, light_cutoff180=0
att = 1.0;
VP = normalize(_gl4es_LightSource_1.position.xyz);
aa = _gl4es_FrontLightProduct_1.ambient.xyz;
back_aa = _gl4es_BackLightProduct_1.ambient.xyz;
nVP = dot(normal, VP);
dd = nVP * _gl4es_FrontLightProduct_1.diffuse.xyz*step(0.0, nVP);
back_dd = -nVP * _gl4es_BackLightProduct_1.diffuse.xyz * step(0.0, -nVP);
hi = normalize(VP + vec3(0., 0., 1.));
lVP = dot(normal, hi);
ss = (pow(lVP, _gl4es_FrontMaterial_shininess)*_gl4es_FrontLightProduct_1.specular.xyz)*step(0.0, nVP)*step(0.0, lVP);
back_ss = (pow(-lVP, _gl4es_BackMaterial_shininess)*_gl4es_BackLightProduct_1.specular.xyz)*step(0.0, -nVP)*step(0.0, -lVP);
Color.rgb += att*(aa+dd+ss);
BackColor.rgb += att*(back_aa+back_dd+back_ss);
// end of light 1
Color.a = _gl4es_FrontMaterial_alpha;
Color.rgb = clamp(Color.rgb, 0., 1.);
BackColor.rgb = clamp(BackColor.rgb, 0., 1.);
BackColor.a = _gl4es_BackMaterial_alpha;
// texturing
}
That one compiles fine.
Only fragment's one in question then..
For the fragment error, it seems it (the Warp3D shader compiler) doesn't like an if
(well here a ternary) that use a built-in uniform.
Maybe I can do a special workaround to copy that builtin in a regular variable...
In meantime will write to authors of GLES2 and warp3d drivers about. That should be fixed on our side anyway as well even if workoround possible (if you will do so, plz also add it like amigao4, so we can remove it later).
Can you try this: in src/gl/fpe_shader.c
line 735
change
sprintf(buff, "vec4 fColor = %s;\n", twosided?"(gl_FrontFacing)?Color:BackColor":"Color");
by
if(twosided) { ShadAppend("bool _gl4es_FrontFacing = gl_FrontFacing;"); }
sprintf(buff, "vec4 fColor = %s;\n", twosided?"(_gl4es_FrontFacing)?Color:BackColor":"Color");
or just try to compile this:
#version 100
precision mediump float;
precision mediump int;
// FPE_Shader generated
// ** Fragment Shader **
// lighting=1, alpha=0, secondary=0, planes=000000, texture=00000000, texformat=00000000 point=0
varying vec4 Color;
varying vec4 BackColor;
void main() {
bool _gl4es_FrontFacing = gl_FrontFacing;
vec4 fColor = (_gl4es_FrontFacing)?Color:BackColor;
gl_FragColor = fColor;
}
Nope, same error about "loading from build int variable is unsupported".. Probably still bugreport is must ?
Yes, you need to make a bug report.
I assume that the built-in is not availble in the Fragment Shader, but should be in the Vertex shader. Are those two shader compiling fine! Vertex
#version 100
precision mediump float;
precision mediump int;
uniform highp mat4 _gl4es_ModelViewProjectionMatrix;
uniform highp mat3 _gl4es_NormalMatrix;
attribute highp vec4 _gl4es_Vertex;
attribute highp vec3 _gl4es_Normal;
struct _gl4es_LightModelProducts
{
vec4 sceneColor;
};
uniform _gl4es_LightModelProducts _gl4es_FrontLightModelProduct;
uniform _gl4es_LightModelProducts _gl4es_BackLightModelProduct;
// FPE_Shader generated
// ** Vertex Shader **
// ligthting=1 (twosided=1, separate=0, color_material=0)
// secondary=0, planes=000000
// texture=00000000, point=0
varying vec4 Color;
struct _gl4es_FPELightSourceParameters1
{
highp vec4 specular;
highp vec4 position;
highp vec3 spotDirection;
highp float spotExponent;
highp float spotCosCutoff;
highp float constantAttenuation;
highp float linearAttenuation;
highp float quadraticAttenuation;
};
struct _gl4es_FPELightSourceParameters0
{
highp vec4 specular;
highp vec4 position;
highp vec3 spotDirection;
highp float spotExponent;
highp float spotCosCutoff;
};
struct _gl4es_LightProducts
{
highp vec4 ambient;
highp vec4 diffuse;
highp vec4 specular;
};
uniform highp float _gl4es_FrontMaterial_shininess;
uniform highp float _gl4es_FrontMaterial_alpha;
uniform highp float _gl4es_BackMaterial_shininess;
uniform highp float _gl4es_BackMaterial_alpha;
uniform _gl4es_FPELightSourceParameters0 _gl4es_LightSource_0;
uniform _gl4es_LightProducts _gl4es_FrontLightProduct_0;
uniform _gl4es_LightProducts _gl4es_BackLightProduct_0;
uniform _gl4es_FPELightSourceParameters0 _gl4es_LightSource_1;
uniform _gl4es_LightProducts _gl4es_FrontLightProduct_1;
uniform _gl4es_LightProducts _gl4es_BackLightProduct_1;
varying vec4 BackColor;
varying bool _gl4es_FrontFacing;
void main() {
_gl4es_FrontFacing = gl_FrontFacing;
vec3 normal = normalize(_gl4es_NormalMatrix * _gl4es_Normal);
gl_Position = _gl4es_ModelViewProjectionMatrix * _gl4es_Vertex;
// ColorMaterial On/Off=0 Front = 0 Back = 0
Color = _gl4es_FrontLightModelProduct.sceneColor;
BackColor = _gl4es_BackLightModelProduct.sceneColor;
highp float att;
highp float spot;
highp vec3 VP;
highp float lVP;
highp float nVP;
highp vec3 aa,dd,ss;
highp vec3 hi;
highp vec3 back_aa,back_dd,back_ss;
// light 0 on, light_direction=0, light_cutoff180=0
att = 1.0;
VP = normalize(_gl4es_LightSource_0.position.xyz);
aa = _gl4es_FrontLightProduct_0.ambient.xyz;
back_aa = _gl4es_BackLightProduct_0.ambient.xyz;
nVP = dot(normal, VP);
dd = nVP * _gl4es_FrontLightProduct_0.diffuse.xyz*step(0.0, nVP);
back_dd = -nVP * _gl4es_BackLightProduct_0.diffuse.xyz * step(0.0, -nVP);
hi = normalize(VP + vec3(0., 0., 1.));
lVP = dot(normal, hi);
ss = (pow(lVP, _gl4es_FrontMaterial_shininess)*_gl4es_FrontLightProduct_0.specular.xyz)*step(0.0, nVP)*step(0.0, lVP);
back_ss = (pow(-lVP, _gl4es_BackMaterial_shininess)*_gl4es_BackLightProduct_0.specular.xyz)*step(0.0, -nVP)*step(0.0, -lVP);
Color.rgb += att*(aa+dd+ss);
BackColor.rgb += att*(back_aa+back_dd+back_ss);
// end of light 0
// light 1 on, light_direction=0, light_cutoff180=0
att = 1.0;
VP = normalize(_gl4es_LightSource_1.position.xyz);
aa = _gl4es_FrontLightProduct_1.ambient.xyz;
back_aa = _gl4es_BackLightProduct_1.ambient.xyz;
nVP = dot(normal, VP);
dd = nVP * _gl4es_FrontLightProduct_1.diffuse.xyz*step(0.0, nVP);
back_dd = -nVP * _gl4es_BackLightProduct_1.diffuse.xyz * step(0.0, -nVP);
hi = normalize(VP + vec3(0., 0., 1.));
lVP = dot(normal, hi);
ss = (pow(lVP, _gl4es_FrontMaterial_shininess)*_gl4es_FrontLightProduct_1.specular.xyz)*step(0.0, nVP)*step(0.0, lVP);
back_ss = (pow(-lVP, _gl4es_BackMaterial_shininess)*_gl4es_BackLightProduct_1.specular.xyz)*step(0.0, -nVP)*step(0.0, -lVP);
Color.rgb += att*(aa+dd+ss);
BackColor.rgb += att*(back_aa+back_dd+back_ss);
// end of light 1
Color.a = _gl4es_FrontMaterial_alpha;
Color.rgb = clamp(Color.rgb, 0., 1.);
BackColor.rgb = clamp(BackColor.rgb, 0., 1.);
BackColor.a = _gl4es_BackMaterial_alpha;
// texturing
}
Fragment:
#version 100
precision mediump float;
precision mediump int;
// FPE_Shader generated
// ** Fragment Shader **
// lighting=1, alpha=0, secondary=0, planes=000000, texture=00000000, texformat=00000000 point=0
varying vec4 Color;
varying vec4 BackColor;
varying bool _gl4es_FrontFacing;
void main() {
vec4 fColor = (_gl4es_FrontFacing)?Color:BackColor;
gl_FragColor = fColor;
}
Something wrong with both shaders from last post : they even didn't compiles via glslangvalidator (kronos's tool for checking shaders).
Fragment one ERROR: 0:9: 'in' : cannot be bool
Vertex: 'out' cannot be bool 'gl_FronFacing' : undeclared identifier 'assing' cannot convert from 'temp float' to 'smooth out bool'
Its not on amigaos even, just pure glslangvalidator
A varying cannot be a bool :(
I'm sorry, but I don't see any practical way to code a workaround in that case (because of the other bug that prevent me to do if
in the vertex shader).
Damn :) If it only was in ogles driver which author very fast on fix bugs .. but its in warp3d , which authors .. not fast :)
I will make bug report about "Loading from built-in variables is unsupported in the fragment shaders". Or maybe not only in fragment, but in any ..
On the other hand, this bug is only blocking for two-sided lighting. I'm not sure many games use that feature, so it shouldn't block the SDL issue investigation.
You mean "shouldn't" probably ?:) Yes, you are right. I will create BZ report for that issue, and a bit persists on the needs for fast fix of "if freeze" issues at least. So we can deal with that too.
If you doesn't mind, let it be opened, so i will not forget about needs to ask developers about fixes again and again :)
Yeah, "shouldn't". I edit my post :( (so many typo I can do...).
Sure, keep the issue open, we'll close it when you have the bugfix.
In fact, it was some left-over some GLES1 conversion in the source of blobloats I used. I removed it and the color are fine now.
I guess the BGRA->RGBA conversion is not bigendian compatible (make sense of course).
I assume you have __BIG_ENDIAN__
automatically define on your side?
I tried something for the BGRA->RGBA conversion on BigEndian. Is it better on your side now?
With that change, things definately changes, but they still not right, new screenshot: http://kas1e.mikendezign.com/aos4/gl4es/games/bloboads/endian1.jpg But its definately the right place to change, and we in the right direction there for sure.
Also, i recieve new warp3d driver, where author together with outher fixes (to be tested) added gl_FrontFacing and gl_FragCoord. So, i check our fargment shader which we have from that Morph3d example:
precision mediump float; precision mediump int; // FPE_Shader generated // Fragment Shader // lighting=1, alpha=0, secondary=0, planes=000000, texture=00000000, texformat=00000000 point=0 varying vec4 Color; varying vec4 BackColor; void main() { vec4 fColor = (gl_FrontFacing)?Color:BackColor; gl_FragColor = fColor; }
And while that shader compiles and checks fine by our internal shader compiler checker (what mean it is indeed added), it still fails inside of GL4ES like that:
glCompileShader(257) glGetShaderiv(257, 0x8B81, 0x6b0564b4) glGetShaderInfoLog(257, 1000, 0x0, 0x6b0564b8) LIBGL: FPE Fragment shader compile failed: ERROR: Code generation failed. Error log: OpSelect instruction isn't implemented yet. INTERNAL ERROR: Store instruction's source parameter is incomplete: OpStore: : tmp21 >> gl_FragColor
Is there still anything missed we need to add, or it's GL4ES side ? (through as it work internally by our checker tools, that probably gl4es ?)
Mmmm, for the BGRA->RGBA, I'll try to fix it (all those big/little endian byte moving is really a nightmare).
For the Shader, it's not gl4es, the error message came from the shader compiler. So I'm not sure why the validator works but not the actual compiler. But there is nothing to be done in gl4es here :( It seems (but I'm really not sure at all) that the ternary operator on the builtin doesn't really work, and fColor
is not filled correctly? You should send the error log the Warp3D developper, he would know better then me what's going on here.
Hm.. Strange that validator works, and not in code.. It can be that language wise code works, but not fill right arguments ?
Compilation of a shader is a simple thing on user side (it's complicated on driver side). You send the sources to the driver and you compile it. Arguments coherency between fragment and vertex are checked only at the Link of the program, not at the compilation of the Shader. Really, all is done in the Driver on this stage.
(can the version of the compiler be slightly different between the validator and the compiler? can OGLES2 alter the shader in a small way?)
Also, I have just pushed some more changes on endiannes for textures.
Sended all info to warp3d developer
Checked endian fixes : yeah ! Take a look :): http://kas1e.mikendezign.com/aos4/gl4es/games/bloboads/endian2.jpg http://kas1e.mikendezign.com/aos4/gl4es/games/bloboads/endian3.jpg
Btw, i also recieve in new driver fix for ternary stuff, so will check this one as well.
Now will try that tetrisclone, which black screen for me on gl4es, but works on legacy. You may want to port it to pandora as well: http://kas1e.mikendezign.com/aos4/gl4es/games/lettersfall/lettersfall-src_beta2.99a.zip
So we can see if it gl4es issue, or, as usuall, on our side :)
Good for endianess texture :)
Too bad there is no fps counter on bloboats, because I think gl4es would show good performances against minigl.
For letterfall, I'll do a pandora build and see how the rendering is done.
letterfall works fine on my side. No issue at all.
And the fps in game is "59 of 63" most of the time, according to the console output, so I guess it really is 60fps with vsync...
I need rebuild the letterfall against new gl4es with endian fixes, maybe it will help somehow. Also will try to debug it futher to see where issue arise.
Also, for bloboats, press F2
ingame to show fps counter.
But, not sure you will see much differences. On the Pandora, I have 60fps (using GLES1.1 backend, and limited by vsync here) while also compiling an emulator at the same time...
Another game you can try is Critical Mass: http://criticalmass.sourceforge.net/critter.php OpenGL renderer is pretty simple too.
Also naev.org was working fine. My last test was with version 0.6.1, I have to try with the latest 0.7.0.
Tryed blobots fps counter : minigl : 123fps, gl4es with debug output enabled, but redirected to the null: 94 fps. I need to rebuild it without debug, to see if it make any differences.
Yes, debug, with all those printf, will slow things down a bit, even when redirected to null.
I'm revisiting my ported game library, looking at OpenGL one.
Another one you can try (in case you don't have enough title to port :p ) is Cylindrix: https://github.com/hyperlogic/cylindrix
Without debug it give 113fp. So, only on 10fps less than legacy minigl. Through, dunno, if it should be like this anyway ?
Our ogles2 authors says that:
It's no surprise that MGL is faster if the TCL workload is low. As soon as MiniGL spends more time in its software TCL than GL4ES need to eventually update the internal VBOs / DBOs / whatever-bookkeeping, MiniGL will become slower. However, at some other point, if the workload is high enough so that the time spent by the GPU outweights the time spent in the respective library significantly, I expect GL4ES to give more or less similar results.
Yeah, bloboats is not GPU intensive. You need more complex game ;)
Firstly want to deal with letterfall, as it cleary show that we have bug somewhere (or in my hacked SDL1 , or in our OGLES2 driver). On minigl version with SDL1 it works fine. And as you say it works fine for you too. So probably again ogles2 driver.. But then how to debug it ..
SDL_GL_SwapBuffer() definatelly calls (i put prinfs in, and i can see them). Is log showing anything bad maybe ? http://kas1e.mikendezign.com/aos4/gl4es/games/lettersfall/letters_fall_debug.txt
I added some simple quad drawing, in the visuals.cpp, right after video mode creates:
glClearColor(0.4f, 0.3f, 0.3f, 255.0f);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(0.7f, 0.8f, 0.3f);
glVertex2f(-0.5f, 0.5f);
glVertex2f(0.5f, 0.5f);
glVertex2f(0.5f, -0.5f);
glVertex2f(-0.5f, -0.5f);
glEnd();
glFlush();
SDL_GL_SwapBuffers();
And it draws, then all loads, and once main loop starts, everything going black and non-visibly, invistigate..
Hm, very intersting.. If i put the same test block, to the main.cpp, right before words printf("Main loop...\n");, also add SDL_Delay(300); so to see what happen, then, i can see how screen clears by my color, but ! no quad draws ! Like glBegin/glEnd didn't take in account anymore ! And then after pause all clear by black, and nothing visibly.. Hm !
There is something odd in the log. If you look for " of 63": that's the fps counter, and this should happens at the SwapBuffers... The fps counter is always "0", that's very low, not sure it's really normal.
All drawing commands seems to be here...
You can also try to press "d" to activate some debug info.
Its normal, i run for now Legacy compiled version, it also shows the same 0 63 at begining. And once everything should draws at once, it just draws, while in gl4es version it also draws, just i see nothing but only black screen (but i can click by mouse on menu, etc, i.e. all logic, etc , works, just don't see it)
I think the "main" drawing command is in screens.cpp
.
Line 98 there is a "global" glColor4f(1.0f, 1.0f, 1.0f, ScreenFadeTransparency);
that (I think) control the color of the screen, for the FadeIn / FadeOut effect.
You can try to play a bit with this. Change ScreenFadeTransparency
to 1.0f
or move that line inside the glBegin()
/glEnd()
(because may be there is still some issue with "constant" vertex attrib ...).
Tried like this:
glBegin(GL_QUADS);
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);//ScreenFadeTransparency);
glEnd();
Didn't change anything .. straaange
No, not like that. Here you draw nothing, it's normal nothing change
Change Lines 103-115 to
glBegin(GL_QUADS);
glColor4f(1.0f, 1.0f, 1.0f, ScreenFadeTransparency);
glTexCoord2i(0, 0);
glVertex3i(0-32, 0-32, 0);
glTexCoord2i(1, 0);
glVertex3i(0+32, 0-32, 0);
glTexCoord2i(1, 1);
glVertex3i(0+32, 0+32, 0);
glTexCoord2i(0, 1);
glVertex3i(0-32, 0+32, 0);
glEnd();
I even comment out whole GL fucntions (starting from glPushMatrix(); and ends with glPopMatrix();, and put there test-block which clear background and should drawn quad : backround clears, but quad didn't draws.
There is source of morph3d whic shows 3D morphing objects. I tested that over legacy opengl, all is fine. By default some figure fly around, and by case 1,2,3,4,5 i can change geometry. Also by space and enter can change the things, too. With GL4ES it show black screen.
So, there is source: http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_4/morph3d_gl4es.c
There is debug output: http://kas1e.mikendezign.com/aos4/gl4es/tests/testcase_4/morph3d_debug.txt
From logs i see that shaders fail, will try to check if they compiles over our shader's compiler at all..