geomstrings_list[geomstrings_count++] = "#define GLSL130\n";
fragstrings_list[fragstrings_count++] = "#define GLSL130\n";
}
+ // if we can do #version 120, we should (this adds the invariant keyword)
+ else if(vid.support.glshaderversion >= 120)
+ {
+ vertstrings_list[vertstrings_count++] = "#version 120\n";
+ geomstrings_list[geomstrings_count++] = "#version 120\n";
+ fragstrings_list[fragstrings_count++] = "#version 120\n";
+ vertstrings_list[vertstrings_count++] = "#define GLSL120\n";
+ geomstrings_list[geomstrings_count++] = "#define GLSL120\n";
+ fragstrings_list[fragstrings_count++] = "#define GLSL120\n";
+ }
+ // GLES also adds several things from GLSL120
+ switch(vid.renderpath)
+ {
+ case RENDERPATH_GLES2:
+ vertstrings_list[vertstrings_count++] = "#define GLES\n";
+ geomstrings_list[geomstrings_count++] = "#define GLES\n";
+ fragstrings_list[fragstrings_count++] = "#define GLES\n";
+ break;
+ default:
+ break;
+ }
// the first pretext is which type of shader to compile as
// (later these will all be bound together as a program object)
while (!r_framedata_mem || r_framedata_mem->current + size > r_framedata_mem->size)
{
// emergency - we ran out of space, allocate more memory
- newvalue = bound(0.25f, r_framedatasize.value * 2.0f, 256.0f);
+ // note: this has no upper-bound, we'll fail to allocate memory eventually and just die
+ newvalue = r_framedatasize.value * 2.0f;
+ // upper bound based on architecture - if we try to allocate more than this we could overflow, better to loop until we error out on allocation failure
+ if (sizeof(size_t) >= 8)
+ newvalue = bound(0.25f, newvalue, (float)(1ll << 42));
+ else
+ newvalue = bound(0.25f, newvalue, (float)(1 << 10));
// this might not be a growing it, but we'll allocate another buffer every time
Cvar_SetValueQuick(&r_framedatasize, newvalue);
R_FrameData_Resize(true);
r_fb.bloomindex = 0;
R_Mesh_SetRenderTargets(r_fb.bloomfbo[r_fb.bloomindex], NULL, r_fb.bloomtexture[r_fb.bloomindex], NULL, NULL, NULL);
R_SetViewport(&r_fb.bloomviewport);
+ GL_CullFace(GL_NONE);
GL_DepthTest(false);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_Color(colorscale, colorscale, colorscale, 1);