The following code throws an error i cant seem to figue out:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
//only relevant uniforms shown
uniform float angle;
uniform vec2 reso;
void main()
{
vec2 wallPos = v_vTexcoord;
vec2 dirVec = vec2(cos(angle)/reso.x,sin(angle)/reso.y);
while (floor(wallPos.x*reso.x+0.5)/reso.x > 0.0 &&
floor(wallPos.x*reso.x+0.5)/reso.x < 1.0 &&
floor(wallPos.y*reso.y+0.5)/reso.y > 0.0 &&
floor(wallPos.y*reso.y+0.5)/reso.y < 1.0)
{
wallPos = vec2(wallPos.x-dirVec.x,wallPos.y-dirVec.y);
}
//Rest of my code after this//
}
The Error reads:
Win32 function failed: HRESULT: 0x887a0005
Call GR_D3D_Device-> CreateBlendState at line 467 in file \StateManagerM.cpp
As further background, im sure that the issue is localized to this while since using just the contained block once throws no error (but wrong results ofc.), also in a specific test the following input variables give the error as well:
//Uniforms
angle: 2.1817
reso: 1932,1068
v_vTexcoord: in the range of 0.0-1.0 ofc
//dirVec post first two lines in void main() using above variables
dirVec = 0.0002969,0.0007670
I have little experience in dealing with opengl-win32 errors so any advice would be appreciated.
My first thought is that the while loop is not being broken but in my mind it very much looks like it should be, other than that could the win32 error be pointing to a memory usage issue cause by large while loop repeats? The maximum loops that could occur is approx 2200.
Edit: Attatched entire fragment shader including (what i believe to be) non error related code: