In relation to issue :
I am trying to get a valid HLSL shader.
I used essl_to_hlsl with as commandline :
-b=h -s=w -o D:\Dev\angle_base\Shaders\ForLoopOptimization.frag
-b=h : output HLSL code
-s=w : use WebGL spec
Contents of input file :
void main(void) {
mediump vec4 red = vec4(1.0, 0.0, 0.0, 1.0);
mediump vec4 green = vec4(0.0, 1.0, 0.0, 1.0);
mediump int store = -1;
for (mediump int i_ix = 0; i_ix < 10; ++i_ix) {
if (i_ix == 4) {
store = i_ix;
break;
}
}
if (store == -1)
gl_FragColor = red;
else
gl_FragColor = green;
}
Output :
#### BEGIN COMPILER 0 INFO LOG ####
#### END COMPILER 0 INFO LOG ####
#### BEGIN COMPILER 0 OBJ CODE ####
// Varyings
static float4 gl_Color[1] = {float4(0, 0, 0, 0)};
void gl_main()
{
{
float4 _red = float4(1.0, 0.0, 0.0, 1.0);
float4 _green = float4(0.0, 1.0, 0.0, 1.0);
int _store = -1;
{
for(int _i_ix = 0; (_i_ix < 10); (++_i_ix))
{
{
if((_i_ix == 4))
{
{
(_store = _i_ix);
break;
;
}
;
}
;
}
;}
}
;
if((_store == -1))
{
(gl_Color[0] = _red);
}
else
{
(gl_Color[0] = _green);
}
;
}
}
#### END COMPILER 0 OBJ CODE ####
But this is not a valid hlsl pixel shader, for instance I see no color semantics (like COLOR0) in the code.
I used this code (slightly modified to compile for pixel and vertex shader model 3.0) to test :
What am I missing ?
Is there some skeleton code which I need to add ?
(I posted this already a few weeks ago but it seems to got lost)
Tibor
On Tuesday, October 30, 2012 11:43:38 AM UTC+1, Tibor den Ouden wrote: