From: havoc Date: Wed, 9 Feb 2011 09:35:12 +0000 (+0000) Subject: removed unmaintained CgGL rendering path X-Git-Tag: xonotic-v0.5.0~438^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ff0a7f475d95e5180b85d1c574b0b9a3156aa525;p=xonotic%2Fdarkplaces.git removed unmaintained CgGL rendering path git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10838 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_backend.c b/gl_backend.c index 24381fb6..a9b01118 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -275,7 +275,6 @@ static void R_Mesh_SetUseVBO(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: gl_state.usevbo_staticvertex = (vid.support.arb_vertex_buffer_object && gl_vbo.integer) || vid.forcevbo; gl_state.usevbo_staticindex = (vid.support.arb_vertex_buffer_object && (gl_vbo.integer == 1 || gl_vbo.integer == 3)) || vid.forcevbo; gl_state.usevbo_dynamicvertex = (vid.support.arb_vertex_buffer_object && gl_vbo_dynamicvertex.integer) || vid.forcevbo; @@ -326,7 +325,6 @@ static void gl_backend_start(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: // fetch current fbo here (default fbo is not 0 on some GLES devices) if (vid.support.ext_framebuffer_object) @@ -358,7 +356,6 @@ static void gl_backend_shutdown(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -404,7 +401,6 @@ static void gl_backend_devicelost(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -432,7 +428,6 @@ static void gl_backend_devicelost(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -465,7 +460,6 @@ static void gl_backend_devicerestored(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -691,7 +685,6 @@ qboolean R_ScissorForBBox(const float *mins, const float *maxs, int *scissor) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -775,7 +768,6 @@ void R_Viewport_InitOrtho(r_viewport_t *v, const matrix4x4_t *cameramatrix, int case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -1024,7 +1016,6 @@ void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatri switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GL13: case RENDERPATH_GL11: case RENDERPATH_SOFT: @@ -1061,7 +1052,6 @@ void R_SetViewport(const r_viewport_t *v) switch(vid.renderpath) { - case RENDERPATH_CGGL: case RENDERPATH_GL13: case RENDERPATH_GL11: CHECKGLERROR @@ -1140,7 +1130,6 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (!vid.support.ext_framebuffer_object) return 0; @@ -1169,7 +1158,6 @@ void R_Mesh_DestroyFramebufferObject(int fbo) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (fbo) qglDeleteFramebuffersEXT(1, (GLuint*)&fbo); @@ -1226,7 +1214,6 @@ void R_Mesh_ResetRenderTargets(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (gl_state.framebufferobject) { @@ -1270,7 +1257,6 @@ void R_Mesh_SetRenderTargets(int fbo, rtexture_t *depthtexture, rtexture_t *colo case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (gl_state.framebufferobject != fbo) { @@ -1403,68 +1389,6 @@ static void GL_Backend_ResetState(void) case RENDERPATH_D3D11: Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); break; - case RENDERPATH_CGGL: - CHECKGLERROR - - qglColorMask(1, 1, 1, 1);CHECKGLERROR - // qglAlphaFunc(gl_state.alphafunc, gl_state.alphafuncvalue);CHECKGLERROR - // qglDisable(GL_ALPHA_TEST);CHECKGLERROR - qglBlendFunc(gl_state.blendfunc1, gl_state.blendfunc2);CHECKGLERROR - qglDisable(GL_BLEND);CHECKGLERROR - qglCullFace(gl_state.cullface);CHECKGLERROR - qglDisable(GL_CULL_FACE);CHECKGLERROR - qglDepthFunc(GL_LEQUAL);CHECKGLERROR - qglEnable(GL_DEPTH_TEST);CHECKGLERROR - qglDepthMask(gl_state.depthmask);CHECKGLERROR - qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]); - - if (vid.support.arb_vertex_buffer_object) - { - qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - } - - if (vid.support.ext_framebuffer_object) - { - qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); - qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - - qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), NULL);CHECKGLERROR - qglEnableClientState(GL_VERTEX_ARRAY);CHECKGLERROR - - qglColorPointer(4, GL_FLOAT, sizeof(float[4]), NULL);CHECKGLERROR - qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR - qglColor4f(1, 1, 1, 1);CHECKGLERROR - - if (vid.support.ext_framebuffer_object) - qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, gl_state.framebufferobject); - - gl_state.unit = MAX_TEXTUREUNITS; - gl_state.clientunit = MAX_TEXTUREUNITS; - for (i = 0;i < vid.teximageunits;i++) - { - GL_ActiveTexture(i); - qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR - if (vid.support.ext_texture_3d) - { - qglBindTexture(GL_TEXTURE_3D, 0);CHECKGLERROR - } - if (vid.support.arb_texture_cube_map) - { - qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);CHECKGLERROR - } - } - - for (i = 0;i < vid.texarrayunits;i++) - { - GL_ClientActiveTexture(i); - GL_BindVBO(0); - qglTexCoordPointer(2, GL_FLOAT, sizeof(float[2]), NULL);CHECKGLERROR - qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR - } - CHECKGLERROR - break; case RENDERPATH_GL13: case RENDERPATH_GL11: CHECKGLERROR @@ -1607,7 +1531,6 @@ void GL_ActiveTexture(unsigned int num) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (qglActiveTexture) { @@ -1635,7 +1558,6 @@ void GL_ClientActiveTexture(unsigned int num) { case RENDERPATH_GL11: case RENDERPATH_GL13: - case RENDERPATH_CGGL: if (qglActiveTexture) { CHECKGLERROR @@ -1669,7 +1591,6 @@ void GL_BlendFunc(int blendfunc1, int blendfunc2) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglBlendFunc(gl_state.blendfunc1, gl_state.blendfunc2);CHECKGLERROR @@ -1743,7 +1664,6 @@ void GL_DepthMask(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglDepthMask(gl_state.depthmask);CHECKGLERROR @@ -1776,7 +1696,6 @@ void GL_DepthTest(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR if (gl_state.depthtest) @@ -1816,7 +1735,6 @@ void GL_DepthFunc(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglDepthFunc(gl_state.depthfunc);CHECKGLERROR @@ -1850,7 +1768,6 @@ void GL_DepthRange(float nearfrac, float farfrac) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglDepthRange(gl_state.depthrange[0], gl_state.depthrange[1]); break; @@ -1888,7 +1805,6 @@ void R_SetStencilSeparate(qboolean enable, int writemask, int frontfail, int fro case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR if (enable) @@ -1955,7 +1871,6 @@ void R_SetStencil(qboolean enable, int writemask, int fail, int zfail, int zpass case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR if (enable) @@ -2012,7 +1927,6 @@ void GL_PolygonOffset(float planeoffset, float depthoffset) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]); break; @@ -2051,7 +1965,6 @@ void GL_SetMirrorState(qboolean state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglCullFace(gl_state.cullface);CHECKGLERROR break; @@ -2088,7 +2001,6 @@ void GL_CullFace(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR @@ -2186,7 +2098,6 @@ void GL_AlphaTest(int state) case RENDERPATH_SOFT: // DPSOFTRAST_AlphaTest(gl_state.alphatest); break; - case RENDERPATH_CGGL: case RENDERPATH_GL20: case RENDERPATH_GLES2: break; @@ -2206,7 +2117,6 @@ void GL_ColorMask(int r, int g, int b, int a) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglColorMask((GLboolean)r, (GLboolean)g, (GLboolean)b, (GLboolean)a);CHECKGLERROR @@ -2241,7 +2151,6 @@ void GL_Color(float cr, float cg, float cb, float ca) { case RENDERPATH_GL11: case RENDERPATH_GL13: - case RENDERPATH_CGGL: CHECKGLERROR qglColor4f(gl_state.color4f[0], gl_state.color4f[1], gl_state.color4f[2], gl_state.color4f[3]); CHECKGLERROR @@ -2269,7 +2178,6 @@ void GL_Scissor (int x, int y, int width, int height) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglScissor(x, y,width,height); @@ -2309,7 +2217,6 @@ void GL_ScissorTest(int state) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR if(gl_state.scissortest) @@ -2352,7 +2259,6 @@ void GL_Clear(int mask, const float *colorvalue, float depthvalue, int stencilva case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR if (mask & GL_COLOR_BUFFER_BIT) @@ -2396,7 +2302,6 @@ void GL_ReadPixelsBGRA(int x, int y, int width, int height, unsigned char *outpi case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglReadPixels(x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, outpixels);CHECKGLERROR @@ -2605,7 +2510,6 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: // check if the user specified to ignore static index buffers if (!gl_state.usevbo_staticindex || (gl_vbo.integer == 3 && !vid.forcevbo && (element3i_bufferoffset || element3s_bufferoffset))) @@ -2724,7 +2628,6 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: CHECKGLERROR if (gl_mesh_testmanualfeeding.integer) { @@ -3044,7 +2947,6 @@ void R_Mesh_UpdateMeshBuffer(r_meshbuffer_t *buffer, const void *data, size_t si case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (!buffer->bufferobject) qglGenBuffersARB(1, (GLuint *)&buffer->bufferobject); @@ -3126,7 +3028,6 @@ void R_Mesh_DestroyMeshBuffer(r_meshbuffer_t *buffer) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglDeleteBuffersARB(1, (GLuint *)&buffer->bufferobject); break; @@ -3182,7 +3083,6 @@ void R_Mesh_VertexPointer(int components, int gltype, size_t stride, const void { case RENDERPATH_GL11: case RENDERPATH_GL13: - case RENDERPATH_CGGL: if (gl_state.pointer_vertex_components != components || gl_state.pointer_vertex_gltype != gltype || gl_state.pointer_vertex_stride != stride || gl_state.pointer_vertex_pointer != pointer || gl_state.pointer_vertex_vertexbuffer != vertexbuffer || gl_state.pointer_vertex_offset != bufferoffset) { int bufferobject = vertexbuffer ? vertexbuffer->bufferobject : 0; @@ -3229,7 +3129,6 @@ void R_Mesh_ColorPointer(int components, int gltype, size_t stride, const void * { case RENDERPATH_GL11: case RENDERPATH_GL13: - case RENDERPATH_CGGL: CHECKGLERROR if (pointer) { @@ -3324,7 +3223,6 @@ void R_Mesh_TexCoordPointer(unsigned int unitnum, int components, int gltype, si { case RENDERPATH_GL11: case RENDERPATH_GL13: - case RENDERPATH_CGGL: CHECKGLERROR if (pointer) { @@ -3425,7 +3323,6 @@ void R_Mesh_CopyToTexture(rtexture_t *tex, int tx, int ty, int sx, int sy, int w case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: R_Mesh_TexBind(0, tex); GL_ActiveTexture(0);CHECKGLERROR @@ -3485,7 +3382,6 @@ void R_Mesh_TexBind(unsigned int unitnum, rtexture_t *tex) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (!tex) { @@ -3651,7 +3547,6 @@ void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (matrix && matrix->m[3][3]) { @@ -3700,7 +3595,6 @@ void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, i switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: // do nothing break; @@ -3793,7 +3687,6 @@ void R_Mesh_ResetTextureState(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: case RENDERPATH_D3D9: case RENDERPATH_D3D10: @@ -3858,7 +3751,6 @@ static void R_Mesh_InitVertexDeclarations(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GL13: case RENDERPATH_GL11: case RENDERPATH_GLES2: @@ -3911,7 +3803,6 @@ void R_Mesh_PrepareVertices_Vertex3f(int numvertices, const float *vertex3f, con switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (vertexbuffer) { @@ -4025,7 +3916,6 @@ void R_Mesh_PrepareVertices_Generic_Arrays(int numvertices, const float *vertex3 switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (!vid.useinterleavedarrays) { @@ -4112,7 +4002,6 @@ void R_Mesh_PrepareVertices_Generic(int numvertices, const r_vertexgeneric_t *ve switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (vertexbuffer) { @@ -4226,7 +4115,6 @@ void R_Mesh_PrepareVertices_Mesh_Arrays(int numvertices, const float *vertex3f, switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (!vid.useinterleavedarrays) { @@ -4324,7 +4212,6 @@ void R_Mesh_PrepareVertices_Mesh(int numvertices, const r_vertexmesh_t *vertex, switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (vertexbuffer) { diff --git a/gl_draw.c b/gl_draw.c index 70600ab3..1654cd4b 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -1916,7 +1916,6 @@ void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: CHECKGLERROR qglBegin(GL_LINE_LOOP); for (num = 0;num < mesh->num_vertices;num++) @@ -1960,7 +1959,6 @@ void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, f case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: CHECKGLERROR //qglLineWidth(width);CHECKGLERROR @@ -2009,7 +2007,6 @@ void DrawQ_Lines (float width, int numlines, const float *vertex3f, const float case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: CHECKGLERROR R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1); @@ -2079,7 +2076,6 @@ void R_DrawGamma(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: diff --git a/gl_rmain.c b/gl_rmain.c index 05ee992a..9f7005d4 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3976,518 +3976,6 @@ void R_SetupShader_SetPermutationGLSL(unsigned int mode, unsigned int permutatio if (r_glsl_permutation->loc_ClientTime >= 0) qglUniform1f(r_glsl_permutation->loc_ClientTime, cl.time); } -#ifdef SUPPORTCG -#include -struct r_cg_permutation_s; -typedef struct r_cg_permutation_s -{ - /// hash lookup data - struct r_cg_permutation_s *hashnext; - unsigned int mode; - unsigned int permutation; - - /// indicates if we have tried compiling this permutation already - qboolean compiled; - /// 0 if compilation failed - CGprogram vprogram; - CGprogram fprogram; - /// locations of detected parameters in programs, or NULL if not found - CGparameter vp_EyePosition; - CGparameter vp_FogPlane; - CGparameter vp_LightDir; - CGparameter vp_LightPosition; - CGparameter vp_ModelToLight; - CGparameter vp_TexMatrix; - CGparameter vp_BackgroundTexMatrix; - CGparameter vp_ModelViewProjectionMatrix; - CGparameter vp_ModelViewMatrix; - CGparameter vp_ShadowMapMatrix; - - CGparameter fp_Texture_First; - CGparameter fp_Texture_Second; - CGparameter fp_Texture_GammaRamps; - CGparameter fp_Texture_Normal; - CGparameter fp_Texture_Color; - CGparameter fp_Texture_Gloss; - CGparameter fp_Texture_Glow; - CGparameter fp_Texture_SecondaryNormal; - CGparameter fp_Texture_SecondaryColor; - CGparameter fp_Texture_SecondaryGloss; - CGparameter fp_Texture_SecondaryGlow; - CGparameter fp_Texture_Pants; - CGparameter fp_Texture_Shirt; - CGparameter fp_Texture_FogHeightTexture; - CGparameter fp_Texture_FogMask; - CGparameter fp_Texture_Lightmap; - CGparameter fp_Texture_Deluxemap; - CGparameter fp_Texture_Attenuation; - CGparameter fp_Texture_Cube; - CGparameter fp_Texture_Refraction; - CGparameter fp_Texture_Reflection; - CGparameter fp_Texture_ShadowMap2D; - CGparameter fp_Texture_CubeProjection; - CGparameter fp_Texture_ScreenDepth; - CGparameter fp_Texture_ScreenNormalMap; - CGparameter fp_Texture_ScreenDiffuse; - CGparameter fp_Texture_ScreenSpecular; - CGparameter fp_Texture_ReflectMask; - CGparameter fp_Texture_ReflectCube; - CGparameter fp_Alpha; - CGparameter fp_BloomBlur_Parameters; - CGparameter fp_ClientTime; - CGparameter fp_Color_Ambient; - CGparameter fp_Color_Diffuse; - CGparameter fp_Color_Specular; - CGparameter fp_Color_Glow; - CGparameter fp_Color_Pants; - CGparameter fp_Color_Shirt; - CGparameter fp_DeferredColor_Ambient; - CGparameter fp_DeferredColor_Diffuse; - CGparameter fp_DeferredColor_Specular; - CGparameter fp_DeferredMod_Diffuse; - CGparameter fp_DeferredMod_Specular; - CGparameter fp_DistortScaleRefractReflect; - CGparameter fp_EyePosition; - CGparameter fp_FogColor; - CGparameter fp_FogHeightFade; - CGparameter fp_FogPlane; - CGparameter fp_FogPlaneViewDist; - CGparameter fp_FogRangeRecip; - CGparameter fp_LightColor; - CGparameter fp_LightDir; - CGparameter fp_LightPosition; - CGparameter fp_OffsetMapping_Scale; - CGparameter fp_PixelSize; - CGparameter fp_ReflectColor; - CGparameter fp_ReflectFactor; - CGparameter fp_ReflectOffset; - CGparameter fp_RefractColor; - CGparameter fp_Saturation; - CGparameter fp_ScreenCenterRefractReflect; - CGparameter fp_ScreenScaleRefractReflect; - CGparameter fp_ScreenToDepth; - CGparameter fp_ShadowMap_Parameters; - CGparameter fp_ShadowMap_TextureScale; - CGparameter fp_SpecularPower; - CGparameter fp_UserVec1; - CGparameter fp_UserVec2; - CGparameter fp_UserVec3; - CGparameter fp_UserVec4; - CGparameter fp_ViewTintColor; - CGparameter fp_ViewToLight; - CGparameter fp_PixelToScreenTexCoord; - CGparameter fp_ModelToReflectCube; - CGparameter fp_BloomColorSubtract; - CGparameter fp_NormalmapScrollBlend; -} -r_cg_permutation_t; - -/// information about each possible shader permutation -r_cg_permutation_t *r_cg_permutationhash[SHADERMODE_COUNT][SHADERPERMUTATION_HASHSIZE]; -/// currently selected permutation -r_cg_permutation_t *r_cg_permutation; -/// storage for permutations linked in the hash table -memexpandablearray_t r_cg_permutationarray; - -#define CHECKCGERROR {CGerror err = cgGetError(), err2 = err;if (err){Con_Printf("%s:%i CG error %i: %s : %s\n", __FILE__, __LINE__, err, cgGetErrorString(err), cgGetLastErrorString(&err2));if (err == 1) Con_Printf("last listing:\n%s\n", cgGetLastListing(vid.cgcontext));}} - -static r_cg_permutation_t *R_CG_FindPermutation(unsigned int mode, unsigned int permutation) -{ - //unsigned int hashdepth = 0; - unsigned int hashindex = (permutation * 0x1021) & (SHADERPERMUTATION_HASHSIZE - 1); - r_cg_permutation_t *p; - for (p = r_cg_permutationhash[mode][hashindex];p;p = p->hashnext) - { - if (p->mode == mode && p->permutation == permutation) - { - //if (hashdepth > 10) - // Con_Printf("R_CG_FindPermutation: Warning: %i:%i has hashdepth %i\n", mode, permutation, hashdepth); - return p; - } - //hashdepth++; - } - p = (r_cg_permutation_t*)Mem_ExpandableArray_AllocRecord(&r_cg_permutationarray); - p->mode = mode; - p->permutation = permutation; - p->hashnext = r_cg_permutationhash[mode][hashindex]; - r_cg_permutationhash[mode][hashindex] = p; - //if (hashdepth > 10) - // Con_Printf("R_CG_FindPermutation: Warning: %i:%i has hashdepth %i\n", mode, permutation, hashdepth); - return p; -} - -static char *R_CG_GetText(const char *filename, qboolean printfromdisknotice) -{ - char *shaderstring; - if (!filename || !filename[0]) - return NULL; - if (!strcmp(filename, "hlsl/default.hlsl")) - { - if (!hlslshaderstring) - { - hlslshaderstring = (char *)FS_LoadFile(filename, r_main_mempool, false, NULL); - if (hlslshaderstring) - Con_DPrintf("Loading shaders from file %s...\n", filename); - else - hlslshaderstring = (char *)builtinhlslshaderstring; - } - shaderstring = (char *) Mem_Alloc(r_main_mempool, strlen(hlslshaderstring) + 1); - memcpy(shaderstring, hlslshaderstring, strlen(hlslshaderstring) + 1); - return shaderstring; - } - shaderstring = (char *)FS_LoadFile(filename, r_main_mempool, false, NULL); - if (shaderstring) - { - if (printfromdisknotice) - Con_DPrintf("from disk %s... ", filename); - return shaderstring; - } - return shaderstring; -} - -static void R_CG_CacheShader(r_cg_permutation_t *p, const char *cachename, const char *vertstring, const char *fragstring) -{ - // TODO: load or create .fp and .vp shader files -} - -static void R_CG_CompilePermutation(r_cg_permutation_t *p, unsigned int mode, unsigned int permutation) -{ - int i; - shadermodeinfo_t *modeinfo = hlslshadermodeinfo + mode; - int vertstring_length = 0; - int geomstring_length = 0; - int fragstring_length = 0; - char *t; - char *vertexstring, *geometrystring, *fragmentstring; - char *vertstring, *geomstring, *fragstring; - char permutationname[256]; - char cachename[256]; - CGprofile vertexProfile; - CGprofile fragmentProfile; - int vertstrings_count = 0; - int geomstrings_count = 0; - int fragstrings_count = 0; - const char *vertstrings_list[32+3+SHADERSTATICPARMS_COUNT+1]; - const char *geomstrings_list[32+3+SHADERSTATICPARMS_COUNT+1]; - const char *fragstrings_list[32+3+SHADERSTATICPARMS_COUNT+1]; - - if (p->compiled) - return; - p->compiled = true; - p->vprogram = NULL; - p->fprogram = NULL; - - permutationname[0] = 0; - cachename[0] = 0; - vertexstring = R_CG_GetText(modeinfo->vertexfilename, true); - geometrystring = R_CG_GetText(modeinfo->geometryfilename, false); - fragmentstring = R_CG_GetText(modeinfo->fragmentfilename, false); - - strlcat(permutationname, modeinfo->vertexfilename, sizeof(permutationname)); - strlcat(cachename, "cggl/", sizeof(cachename)); - - // the first pretext is which type of shader to compile as - // (later these will all be bound together as a program object) - vertstrings_list[vertstrings_count++] = "#define VERTEX_SHADER\n"; - geomstrings_list[geomstrings_count++] = "#define GEOMETRY_SHADER\n"; - fragstrings_list[fragstrings_count++] = "#define FRAGMENT_SHADER\n"; - - // the second pretext is the mode (for example a light source) - vertstrings_list[vertstrings_count++] = modeinfo->pretext; - geomstrings_list[geomstrings_count++] = modeinfo->pretext; - fragstrings_list[fragstrings_count++] = modeinfo->pretext; - strlcat(permutationname, modeinfo->name, sizeof(permutationname)); - strlcat(cachename, modeinfo->name, sizeof(cachename)); - - // now add all the permutation pretexts - for (i = 0;i < SHADERPERMUTATION_COUNT;i++) - { - if (permutation & (1<vprogram) - p->vprogram = cgCreateProgram(vid.cgcontext, CG_SOURCE, vertstring, vertexProfile, NULL, NULL); - CHECKCGERROR - if (fragstring[0] && !p->fprogram) - p->fprogram = cgCreateProgram(vid.cgcontext, CG_SOURCE, fragstring, fragmentProfile, NULL, NULL); - CHECKCGERROR - - // look up all the uniform variable names we care about, so we don't - // have to look them up every time we set them - if (p->vprogram) - { - CHECKCGERROR - cgGLLoadProgram(p->vprogram);CHECKCGERROR CHECKGLERROR - cgGLEnableProfile(vertexProfile);CHECKCGERROR CHECKGLERROR - p->vp_EyePosition = cgGetNamedParameter(p->vprogram, "EyePosition"); - p->vp_FogPlane = cgGetNamedParameter(p->vprogram, "FogPlane"); - p->vp_LightDir = cgGetNamedParameter(p->vprogram, "LightDir"); - p->vp_LightPosition = cgGetNamedParameter(p->vprogram, "LightPosition"); - p->vp_ModelToLight = cgGetNamedParameter(p->vprogram, "ModelToLight"); - p->vp_TexMatrix = cgGetNamedParameter(p->vprogram, "TexMatrix"); - p->vp_BackgroundTexMatrix = cgGetNamedParameter(p->vprogram, "BackgroundTexMatrix"); - p->vp_ModelViewProjectionMatrix = cgGetNamedParameter(p->vprogram, "ModelViewProjectionMatrix"); - p->vp_ModelViewMatrix = cgGetNamedParameter(p->vprogram, "ModelViewMatrix"); - p->vp_ShadowMapMatrix = cgGetNamedParameter(p->vprogram, "ShadowMapMatrix"); - CHECKCGERROR - } - if (p->fprogram) - { - CHECKCGERROR - cgGLLoadProgram(p->fprogram);CHECKCGERROR CHECKGLERROR - cgGLEnableProfile(fragmentProfile);CHECKCGERROR CHECKGLERROR - p->fp_Texture_First = cgGetNamedParameter(p->fprogram, "Texture_First"); - p->fp_Texture_Second = cgGetNamedParameter(p->fprogram, "Texture_Second"); - p->fp_Texture_GammaRamps = cgGetNamedParameter(p->fprogram, "Texture_GammaRamps"); - p->fp_Texture_Normal = cgGetNamedParameter(p->fprogram, "Texture_Normal"); - p->fp_Texture_Color = cgGetNamedParameter(p->fprogram, "Texture_Color"); - p->fp_Texture_Gloss = cgGetNamedParameter(p->fprogram, "Texture_Gloss"); - p->fp_Texture_Glow = cgGetNamedParameter(p->fprogram, "Texture_Glow"); - p->fp_Texture_SecondaryNormal = cgGetNamedParameter(p->fprogram, "Texture_SecondaryNormal"); - p->fp_Texture_SecondaryColor = cgGetNamedParameter(p->fprogram, "Texture_SecondaryColor"); - p->fp_Texture_SecondaryGloss = cgGetNamedParameter(p->fprogram, "Texture_SecondaryGloss"); - p->fp_Texture_SecondaryGlow = cgGetNamedParameter(p->fprogram, "Texture_SecondaryGlow"); - p->fp_Texture_Pants = cgGetNamedParameter(p->fprogram, "Texture_Pants"); - p->fp_Texture_Shirt = cgGetNamedParameter(p->fprogram, "Texture_Shirt"); - p->fp_Texture_FogHeightTexture = cgGetNamedParameter(p->fprogram, "Texture_FogHeightTexture"); - p->fp_Texture_FogMask = cgGetNamedParameter(p->fprogram, "Texture_FogMask"); - p->fp_Texture_Lightmap = cgGetNamedParameter(p->fprogram, "Texture_Lightmap"); - p->fp_Texture_Deluxemap = cgGetNamedParameter(p->fprogram, "Texture_Deluxemap"); - p->fp_Texture_Attenuation = cgGetNamedParameter(p->fprogram, "Texture_Attenuation"); - p->fp_Texture_Cube = cgGetNamedParameter(p->fprogram, "Texture_Cube"); - p->fp_Texture_Refraction = cgGetNamedParameter(p->fprogram, "Texture_Refraction"); - p->fp_Texture_Reflection = cgGetNamedParameter(p->fprogram, "Texture_Reflection"); - p->fp_Texture_ShadowMap2D = cgGetNamedParameter(p->fprogram, "Texture_ShadowMap2D"); - p->fp_Texture_CubeProjection = cgGetNamedParameter(p->fprogram, "Texture_CubeProjection"); - p->fp_Texture_ScreenDepth = cgGetNamedParameter(p->fprogram, "Texture_ScreenDepth"); - p->fp_Texture_ScreenNormalMap = cgGetNamedParameter(p->fprogram, "Texture_ScreenNormalMap"); - p->fp_Texture_ScreenDiffuse = cgGetNamedParameter(p->fprogram, "Texture_ScreenDiffuse"); - p->fp_Texture_ScreenSpecular = cgGetNamedParameter(p->fprogram, "Texture_ScreenSpecular"); - p->fp_Texture_ReflectMask = cgGetNamedParameter(p->fprogram, "Texture_ReflectMask"); - p->fp_Texture_ReflectCube = cgGetNamedParameter(p->fprogram, "Texture_ReflectCube"); - p->fp_Alpha = cgGetNamedParameter(p->fprogram, "Alpha"); - p->fp_BloomBlur_Parameters = cgGetNamedParameter(p->fprogram, "BloomBlur_Parameters"); - p->fp_ClientTime = cgGetNamedParameter(p->fprogram, "ClientTime"); - p->fp_Color_Ambient = cgGetNamedParameter(p->fprogram, "Color_Ambient"); - p->fp_Color_Diffuse = cgGetNamedParameter(p->fprogram, "Color_Diffuse"); - p->fp_Color_Specular = cgGetNamedParameter(p->fprogram, "Color_Specular"); - p->fp_Color_Glow = cgGetNamedParameter(p->fprogram, "Color_Glow"); - p->fp_Color_Pants = cgGetNamedParameter(p->fprogram, "Color_Pants"); - p->fp_Color_Shirt = cgGetNamedParameter(p->fprogram, "Color_Shirt"); - p->fp_DeferredColor_Ambient = cgGetNamedParameter(p->fprogram, "DeferredColor_Ambient"); - p->fp_DeferredColor_Diffuse = cgGetNamedParameter(p->fprogram, "DeferredColor_Diffuse"); - p->fp_DeferredColor_Specular = cgGetNamedParameter(p->fprogram, "DeferredColor_Specular"); - p->fp_DeferredMod_Diffuse = cgGetNamedParameter(p->fprogram, "DeferredMod_Diffuse"); - p->fp_DeferredMod_Specular = cgGetNamedParameter(p->fprogram, "DeferredMod_Specular"); - p->fp_DistortScaleRefractReflect = cgGetNamedParameter(p->fprogram, "DistortScaleRefractReflect"); - p->fp_EyePosition = cgGetNamedParameter(p->fprogram, "EyePosition"); - p->fp_FogColor = cgGetNamedParameter(p->fprogram, "FogColor"); - p->fp_FogHeightFade = cgGetNamedParameter(p->fprogram, "FogHeightFade"); - p->fp_FogPlane = cgGetNamedParameter(p->fprogram, "FogPlane"); - p->fp_FogPlaneViewDist = cgGetNamedParameter(p->fprogram, "FogPlaneViewDist"); - p->fp_FogRangeRecip = cgGetNamedParameter(p->fprogram, "FogRangeRecip"); - p->fp_LightColor = cgGetNamedParameter(p->fprogram, "LightColor"); - p->fp_LightDir = cgGetNamedParameter(p->fprogram, "LightDir"); - p->fp_LightPosition = cgGetNamedParameter(p->fprogram, "LightPosition"); - p->fp_OffsetMapping_Scale = cgGetNamedParameter(p->fprogram, "OffsetMapping_Scale"); - p->fp_PixelSize = cgGetNamedParameter(p->fprogram, "PixelSize"); - p->fp_ReflectColor = cgGetNamedParameter(p->fprogram, "ReflectColor"); - p->fp_ReflectFactor = cgGetNamedParameter(p->fprogram, "ReflectFactor"); - p->fp_ReflectOffset = cgGetNamedParameter(p->fprogram, "ReflectOffset"); - p->fp_RefractColor = cgGetNamedParameter(p->fprogram, "RefractColor"); - p->fp_Saturation = cgGetNamedParameter(p->fprogram, "Saturation"); - p->fp_ScreenCenterRefractReflect = cgGetNamedParameter(p->fprogram, "ScreenCenterRefractReflect"); - p->fp_ScreenScaleRefractReflect = cgGetNamedParameter(p->fprogram, "ScreenScaleRefractReflect"); - p->fp_ScreenToDepth = cgGetNamedParameter(p->fprogram, "ScreenToDepth"); - p->fp_ShadowMap_Parameters = cgGetNamedParameter(p->fprogram, "ShadowMap_Parameters"); - p->fp_ShadowMap_TextureScale = cgGetNamedParameter(p->fprogram, "ShadowMap_TextureScale"); - p->fp_SpecularPower = cgGetNamedParameter(p->fprogram, "SpecularPower"); - p->fp_UserVec1 = cgGetNamedParameter(p->fprogram, "UserVec1"); - p->fp_UserVec2 = cgGetNamedParameter(p->fprogram, "UserVec2"); - p->fp_UserVec3 = cgGetNamedParameter(p->fprogram, "UserVec3"); - p->fp_UserVec4 = cgGetNamedParameter(p->fprogram, "UserVec4"); - p->fp_ViewTintColor = cgGetNamedParameter(p->fprogram, "ViewTintColor"); - p->fp_ViewToLight = cgGetNamedParameter(p->fprogram, "ViewToLight"); - p->fp_PixelToScreenTexCoord = cgGetNamedParameter(p->fprogram, "PixelToScreenTexCoord"); - p->fp_ModelToReflectCube = cgGetNamedParameter(p->fprogram, "ModelToReflectCube"); - p->fp_BloomColorSubtract = cgGetNamedParameter(p->fprogram, "BloomColorSubtract"); - p->fp_NormalmapScrollBlend = cgGetNamedParameter(p->fprogram, "NormalmapScrollBlend"); - CHECKCGERROR - } - - if ((p->vprogram || !vertstring[0]) && (p->fprogram || !fragstring[0])) - Con_DPrintf("^5CG shader %s compiled.\n", permutationname); - else - Con_Printf("^1CG shader %s failed! some features may not work properly.\n", permutationname); - - // free the strings - if (vertstring) - Mem_Free(vertstring); - if (geomstring) - Mem_Free(geomstring); - if (fragstring) - Mem_Free(fragstring); - if (vertexstring) - Mem_Free(vertexstring); - if (geometrystring) - Mem_Free(geometrystring); - if (fragmentstring) - Mem_Free(fragmentstring); -} - -void R_SetupShader_SetPermutationCG(unsigned int mode, unsigned int permutation) -{ - r_cg_permutation_t *perm = R_CG_FindPermutation(mode, permutation); - CHECKGLERROR - CHECKCGERROR - if (r_cg_permutation != perm) - { - r_cg_permutation = perm; - if (!r_cg_permutation->vprogram && !r_cg_permutation->fprogram) - { - if (!r_cg_permutation->compiled) - R_CG_CompilePermutation(perm, mode, permutation); - if (!r_cg_permutation->vprogram && !r_cg_permutation->fprogram) - { - // remove features until we find a valid permutation - int i; - for (i = 0;i < SHADERPERMUTATION_COUNT;i++) - { - // reduce i more quickly whenever it would not remove any bits - int j = 1<<(SHADERPERMUTATION_COUNT-1-i); - if (!(permutation & j)) - continue; - permutation -= j; - r_cg_permutation = R_CG_FindPermutation(mode, permutation); - if (!r_cg_permutation->compiled) - R_CG_CompilePermutation(perm, mode, permutation); - if (r_cg_permutation->vprogram || r_cg_permutation->fprogram) - break; - } - if (i >= SHADERPERMUTATION_COUNT) - { - //Con_Printf("Could not find a working Cg shader for permutation %s %s\n", shadermodeinfo[mode].vertexfilename, shadermodeinfo[mode].pretext); - r_cg_permutation = R_CG_FindPermutation(mode, permutation); - return; // no bit left to clear, entire mode is broken - } - } - } - CHECKGLERROR - CHECKCGERROR - if (r_cg_permutation->vprogram) - { - cgGLLoadProgram(r_cg_permutation->vprogram);CHECKCGERROR CHECKGLERROR - cgGLBindProgram(r_cg_permutation->vprogram);CHECKCGERROR CHECKGLERROR - cgGLEnableProfile(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR - } - else - { - cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR - cgGLUnbindProgram(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR - } - if (r_cg_permutation->fprogram) - { - cgGLLoadProgram(r_cg_permutation->fprogram);CHECKCGERROR CHECKGLERROR - cgGLBindProgram(r_cg_permutation->fprogram);CHECKCGERROR CHECKGLERROR - cgGLEnableProfile(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR - } - else - { - cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR - cgGLUnbindProgram(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR - } - } - CHECKCGERROR - if (r_cg_permutation->vp_ModelViewProjectionMatrix) cgGLSetMatrixParameterfc(r_cg_permutation->vp_ModelViewProjectionMatrix, gl_modelviewprojection16f);CHECKCGERROR - if (r_cg_permutation->vp_ModelViewMatrix) cgGLSetMatrixParameterfc(r_cg_permutation->vp_ModelViewMatrix, gl_modelview16f);CHECKCGERROR - if (r_cg_permutation->fp_ClientTime) cgGLSetParameter1f(r_cg_permutation->fp_ClientTime, cl.time);CHECKCGERROR -} - -void CG_BindTexture(CGparameter param, rtexture_t *tex) -{ - cgGLSetTextureParameter(param, R_GetTexture(tex)); - cgGLEnableTextureParameter(param); -} -#endif - #ifdef SUPPORTD3D #ifdef SUPPORTD3D @@ -4973,7 +4461,7 @@ void R_SetupShader_SetPermutationHLSL(unsigned int mode, unsigned int permutatio } if (i >= SHADERPERMUTATION_COUNT) { - //Con_Printf("Could not find a working Cg shader for permutation %s %s\n", shadermodeinfo[mode].vertexfilename, shadermodeinfo[mode].pretext); + //Con_Printf("Could not find a working HLSL shader for permutation %s %s\n", shadermodeinfo[mode].vertexfilename, shadermodeinfo[mode].pretext); r_hlsl_permutation = R_HLSL_FindPermutation(mode, permutation); return; // no bit left to clear, entire mode is broken } @@ -5012,10 +4500,6 @@ void R_GLSL_Restart_f(void) { r_hlsl_permutation_t *p; r_hlsl_permutation = NULL; -// cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR -// cgGLUnbindProgram(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR -// cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR -// cgGLUnbindProgram(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR limit = Mem_ExpandableArray_IndexRange(&r_hlsl_permutationarray); for (i = 0;i < limit;i++) { @@ -5055,31 +4539,6 @@ void R_GLSL_Restart_f(void) memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash)); } break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - { - r_cg_permutation_t *p; - r_cg_permutation = NULL; - cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR - cgGLUnbindProgram(cgGLGetLatestProfile(CG_GL_VERTEX));CHECKCGERROR CHECKGLERROR - cgGLDisableProfile(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR - cgGLUnbindProgram(cgGLGetLatestProfile(CG_GL_FRAGMENT));CHECKCGERROR CHECKGLERROR - limit = Mem_ExpandableArray_IndexRange(&r_cg_permutationarray); - for (i = 0;i < limit;i++) - { - if ((p = (r_cg_permutation_t*)Mem_ExpandableArray_RecordAtIndex(&r_cg_permutationarray, i))) - { - if (p->vprogram) - cgDestroyProgram(p->vprogram); - if (p->fprogram) - cgDestroyProgram(p->fprogram); - Mem_ExpandableArray_FreeRecord(&r_cg_permutationarray, (void*)p); - } - } - memset(r_cg_permutationhash, 0, sizeof(r_cg_permutationhash)); - } -#endif - break; case RENDERPATH_GL13: case RENDERPATH_GL11: break; @@ -5153,14 +4612,6 @@ void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemod R_Mesh_TexBind(r_glsl_permutation->tex_Texture_First , first ); R_Mesh_TexBind(r_glsl_permutation->tex_Texture_Second, second); break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - CHECKCGERROR - R_SetupShader_SetPermutationCG(SHADERMODE_GENERIC, SHADERPERMUTATION_VIEWTINT | (first ? SHADERPERMUTATION_DIFFUSE : 0) | (second ? SHADERPERMUTATION_SPECULAR : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0)))); - if (r_cg_permutation->fp_Texture_First ) CG_BindTexture(r_cg_permutation->fp_Texture_First , first );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Second) CG_BindTexture(r_cg_permutation->fp_Texture_Second, second);CHECKCGERROR -#endif - break; case RENDERPATH_GL13: R_Mesh_TexBind(0, first ); R_Mesh_TexCombine(0, GL_MODULATE, GL_MODULATE, 1, 1); @@ -5198,11 +4649,6 @@ void R_SetupShader_DepthOrShadow(void) case RENDERPATH_GLES2: R_SetupShader_SetPermutationGLSL(SHADERMODE_DEPTH_OR_SHADOW, 0); break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - R_SetupShader_SetPermutationCG(SHADERMODE_DEPTH_OR_SHADOW, 0); -#endif - break; case RENDERPATH_GL13: R_Mesh_TexBind(0, 0); R_Mesh_TexBind(1, 0); @@ -5235,11 +4681,6 @@ void R_SetupShader_ShowDepth(void) case RENDERPATH_GLES2: R_SetupShader_SetPermutationGLSL(SHADERMODE_SHOWDEPTH, 0); break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - R_SetupShader_SetPermutationCG(SHADERMODE_SHOWDEPTH, 0); -#endif - break; case RENDERPATH_GL13: break; case RENDERPATH_GL11: @@ -6015,176 +5456,6 @@ void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, } CHECKGLERROR break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - if (!vid.useinterleavedarrays) - { - RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_VECTOR | (rsurface.modellightmapcolor4f ? BATCHNEED_ARRAY_VERTEXCOLOR : 0) | BATCHNEED_ARRAY_TEXCOORD | (rsurface.uselightmaptexture ? BATCHNEED_ARRAY_LIGHTMAP : 0), texturenumsurfaces, texturesurfacelist); - R_Mesh_VertexPointer( 3, GL_FLOAT, sizeof(float[3]), rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer, rsurface.batchvertex3f_bufferoffset); - R_Mesh_ColorPointer( 4, GL_FLOAT, sizeof(float[4]), rsurface.batchlightmapcolor4f, rsurface.batchlightmapcolor4f_vertexbuffer, rsurface.batchlightmapcolor4f_bufferoffset); - R_Mesh_TexCoordPointer(0, 2, GL_FLOAT, sizeof(float[2]), rsurface.batchtexcoordtexture2f, rsurface.batchtexcoordtexture2f_vertexbuffer, rsurface.batchtexcoordtexture2f_bufferoffset); - R_Mesh_TexCoordPointer(1, 3, GL_FLOAT, sizeof(float[3]), rsurface.batchsvector3f, rsurface.batchsvector3f_vertexbuffer, rsurface.batchsvector3f_bufferoffset); - R_Mesh_TexCoordPointer(2, 3, GL_FLOAT, sizeof(float[3]), rsurface.batchtvector3f, rsurface.batchtvector3f_vertexbuffer, rsurface.batchtvector3f_bufferoffset); - R_Mesh_TexCoordPointer(3, 3, GL_FLOAT, sizeof(float[3]), rsurface.batchnormal3f, rsurface.batchnormal3f_vertexbuffer, rsurface.batchnormal3f_bufferoffset); - R_Mesh_TexCoordPointer(4, 2, GL_FLOAT, sizeof(float[2]), rsurface.batchtexcoordlightmap2f, rsurface.batchtexcoordlightmap2f_vertexbuffer, rsurface.batchtexcoordlightmap2f_bufferoffset); - } - else - { - RSurf_PrepareVerticesForBatch(BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR | (rsurface.modellightmapcolor4f ? BATCHNEED_VERTEXMESH_VERTEXCOLOR : 0) | BATCHNEED_VERTEXMESH_TEXCOORD | (rsurface.uselightmaptexture ? BATCHNEED_VERTEXMESH_LIGHTMAP : 0), texturenumsurfaces, texturesurfacelist); - R_Mesh_PrepareVertices_Mesh(rsurface.batchnumvertices, rsurface.batchvertexmesh, rsurface.batchvertexmeshbuffer); - } - R_SetupShader_SetPermutationCG(mode, permutation); - if (r_cg_permutation->fp_ModelToReflectCube) {Matrix4x4_ToArrayFloatGL(&rsurface.matrix, m16f);cgGLSetMatrixParameterfc(r_cg_permutation->fp_ModelToReflectCube, m16f);}CHECKCGERROR - if (mode == SHADERMODE_LIGHTSOURCE) - { - if (r_cg_permutation->vp_ModelToLight) {Matrix4x4_ToArrayFloatGL(&rsurface.entitytolight, m16f);cgGLSetMatrixParameterfc(r_cg_permutation->vp_ModelToLight, m16f);}CHECKCGERROR - if (r_cg_permutation->vp_LightPosition) cgGLSetParameter3f(r_cg_permutation->vp_LightPosition, rsurface.entitylightorigin[0], rsurface.entitylightorigin[1], rsurface.entitylightorigin[2]);CHECKCGERROR - } - else - { - if (mode == SHADERMODE_LIGHTDIRECTION) - { - if (r_cg_permutation->vp_LightDir) cgGLSetParameter3f(r_cg_permutation->vp_LightDir, rsurface.modellight_lightdir[0], rsurface.modellight_lightdir[1], rsurface.modellight_lightdir[2]);CHECKCGERROR - } - } - if (r_cg_permutation->vp_TexMatrix) {Matrix4x4_ToArrayFloatGL(&rsurface.texture->currenttexmatrix, m16f);cgGLSetMatrixParameterfc(r_cg_permutation->vp_TexMatrix, m16f);}CHECKCGERROR - if (r_cg_permutation->vp_BackgroundTexMatrix) {Matrix4x4_ToArrayFloatGL(&rsurface.texture->currentbackgroundtexmatrix, m16f);cgGLSetMatrixParameterfc(r_cg_permutation->vp_BackgroundTexMatrix, m16f);}CHECKCGERROR - if (r_cg_permutation->vp_ShadowMapMatrix) {Matrix4x4_ToArrayFloatGL(&r_shadow_shadowmapmatrix, m16f);cgGLSetMatrixParameterfc(r_cg_permutation->vp_ShadowMapMatrix, m16f);}CHECKGLERROR - if (r_cg_permutation->vp_EyePosition) cgGLSetParameter3f(r_cg_permutation->vp_EyePosition, rsurface.localvieworigin[0], rsurface.localvieworigin[1], rsurface.localvieworigin[2]);CHECKCGERROR - if (r_cg_permutation->vp_FogPlane) cgGLSetParameter4f(r_cg_permutation->vp_FogPlane, rsurface.fogplane[0], rsurface.fogplane[1], rsurface.fogplane[2], rsurface.fogplane[3]);CHECKCGERROR - CHECKGLERROR - - if (mode == SHADERMODE_LIGHTSOURCE) - { - if (r_cg_permutation->fp_LightPosition) cgGLSetParameter3f(r_cg_permutation->fp_LightPosition, rsurface.entitylightorigin[0], rsurface.entitylightorigin[1], rsurface.entitylightorigin[2]);CHECKCGERROR - if (r_cg_permutation->fp_LightColor) cgGLSetParameter3f(r_cg_permutation->fp_LightColor, lightcolorbase[0], lightcolorbase[1], lightcolorbase[2]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Ambient) cgGLSetParameter3f(r_cg_permutation->fp_Color_Ambient, colormod[0] * ambientscale, colormod[1] * ambientscale, colormod[2] * ambientscale);CHECKCGERROR - if (r_cg_permutation->fp_Color_Diffuse) cgGLSetParameter3f(r_cg_permutation->fp_Color_Diffuse, colormod[0] * diffusescale, colormod[1] * diffusescale, colormod[2] * diffusescale);CHECKCGERROR - if (r_cg_permutation->fp_Color_Specular) cgGLSetParameter3f(r_cg_permutation->fp_Color_Specular, r_refdef.view.colorscale * specularscale, r_refdef.view.colorscale * specularscale, r_refdef.view.colorscale * specularscale);CHECKCGERROR - - // additive passes are only darkened by fog, not tinted - if (r_cg_permutation->fp_FogColor) cgGLSetParameter3f(r_cg_permutation->fp_FogColor, 0, 0, 0);CHECKCGERROR - if (r_cg_permutation->fp_SpecularPower) cgGLSetParameter1f(r_cg_permutation->fp_SpecularPower, rsurface.texture->specularpower * (r_shadow_glossexact.integer ? 0.25f : 1.0f));CHECKCGERROR - } - else - { - if (mode == SHADERMODE_FLATCOLOR) - { - if (r_cg_permutation->fp_Color_Ambient) cgGLSetParameter3f(r_cg_permutation->fp_Color_Ambient, colormod[0], colormod[1], colormod[2]);CHECKCGERROR - } - else if (mode == SHADERMODE_LIGHTDIRECTION) - { - if (r_cg_permutation->fp_Color_Ambient) cgGLSetParameter3f(r_cg_permutation->fp_Color_Ambient, (r_refdef.scene.ambient + rsurface.modellight_ambient[0] * r_refdef.lightmapintensity) * colormod[0], (r_refdef.scene.ambient + rsurface.modellight_ambient[1] * r_refdef.lightmapintensity) * colormod[1], (r_refdef.scene.ambient + rsurface.modellight_ambient[2] * r_refdef.lightmapintensity) * colormod[2]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Diffuse) cgGLSetParameter3f(r_cg_permutation->fp_Color_Diffuse, r_refdef.lightmapintensity * colormod[0], r_refdef.lightmapintensity * colormod[1], r_refdef.lightmapintensity * colormod[2]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Specular) cgGLSetParameter3f(r_cg_permutation->fp_Color_Specular, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale);CHECKCGERROR - if (r_cg_permutation->fp_DeferredMod_Diffuse) cgGLSetParameter3f(r_cg_permutation->fp_DeferredMod_Diffuse, colormod[0] * r_shadow_deferred_8bitrange.value, colormod[1] * r_shadow_deferred_8bitrange.value, colormod[2] * r_shadow_deferred_8bitrange.value);CHECKCGERROR - if (r_cg_permutation->fp_DeferredMod_Specular) cgGLSetParameter3f(r_cg_permutation->fp_DeferredMod_Specular, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value);CHECKCGERROR - if (r_cg_permutation->fp_LightColor) cgGLSetParameter3f(r_cg_permutation->fp_LightColor, rsurface.modellight_diffuse[0], rsurface.modellight_diffuse[1], rsurface.modellight_diffuse[2]);CHECKCGERROR - if (r_cg_permutation->fp_LightDir) cgGLSetParameter3f(r_cg_permutation->fp_LightDir, rsurface.modellight_lightdir[0], rsurface.modellight_lightdir[1], rsurface.modellight_lightdir[2]);CHECKCGERROR - } - else - { - if (r_cg_permutation->fp_Color_Ambient) cgGLSetParameter3f(r_cg_permutation->fp_Color_Ambient, r_refdef.scene.ambient * colormod[0], r_refdef.scene.ambient * colormod[1], r_refdef.scene.ambient * colormod[2]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Diffuse) cgGLSetParameter3f(r_cg_permutation->fp_Color_Diffuse, rsurface.texture->lightmapcolor[0], rsurface.texture->lightmapcolor[1], rsurface.texture->lightmapcolor[2]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Specular) cgGLSetParameter3f(r_cg_permutation->fp_Color_Specular, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale, r_refdef.lightmapintensity * r_refdef.view.colorscale * specularscale);CHECKCGERROR - if (r_cg_permutation->fp_DeferredMod_Diffuse) cgGLSetParameter3f(r_cg_permutation->fp_DeferredMod_Diffuse, colormod[0] * diffusescale * r_shadow_deferred_8bitrange.value, colormod[1] * diffusescale * r_shadow_deferred_8bitrange.value, colormod[2] * diffusescale * r_shadow_deferred_8bitrange.value);CHECKCGERROR - if (r_cg_permutation->fp_DeferredMod_Specular) cgGLSetParameter3f(r_cg_permutation->fp_DeferredMod_Specular, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value, specularscale * r_shadow_deferred_8bitrange.value);CHECKCGERROR - } - // additive passes are only darkened by fog, not tinted - if (r_cg_permutation->fp_FogColor) - { - if (rsurface.texture->currentmaterialflags & MATERIALFLAG_ADD) - cgGLSetParameter3f(r_cg_permutation->fp_FogColor, 0, 0, 0); - else - cgGLSetParameter3f(r_cg_permutation->fp_FogColor, r_refdef.fogcolor[0], r_refdef.fogcolor[1], r_refdef.fogcolor[2]); - CHECKCGERROR - } - if (r_cg_permutation->fp_DistortScaleRefractReflect) cgGLSetParameter4f(r_cg_permutation->fp_DistortScaleRefractReflect, r_water_refractdistort.value * rsurface.texture->refractfactor, r_water_refractdistort.value * rsurface.texture->refractfactor, r_water_reflectdistort.value * rsurface.texture->reflectfactor, r_water_reflectdistort.value * rsurface.texture->reflectfactor);CHECKCGERROR - if (r_cg_permutation->fp_ScreenScaleRefractReflect) cgGLSetParameter4f(r_cg_permutation->fp_ScreenScaleRefractReflect, r_waterstate.screenscale[0], r_waterstate.screenscale[1], r_waterstate.screenscale[0], r_waterstate.screenscale[1]);CHECKCGERROR - if (r_cg_permutation->fp_ScreenCenterRefractReflect) cgGLSetParameter4f(r_cg_permutation->fp_ScreenCenterRefractReflect, r_waterstate.screencenter[0], r_waterstate.screencenter[1], r_waterstate.screencenter[0], r_waterstate.screencenter[1]);CHECKCGERROR - if (r_cg_permutation->fp_RefractColor) cgGLSetParameter4f(r_cg_permutation->fp_RefractColor, rsurface.texture->refractcolor4f[0], rsurface.texture->refractcolor4f[1], rsurface.texture->refractcolor4f[2], rsurface.texture->refractcolor4f[3] * rsurface.texture->lightmapcolor[3]);CHECKCGERROR - if (r_cg_permutation->fp_ReflectColor) cgGLSetParameter4f(r_cg_permutation->fp_ReflectColor, rsurface.texture->reflectcolor4f[0], rsurface.texture->reflectcolor4f[1], rsurface.texture->reflectcolor4f[2], rsurface.texture->reflectcolor4f[3] * rsurface.texture->lightmapcolor[3]);CHECKCGERROR - if (r_cg_permutation->fp_ReflectFactor) cgGLSetParameter1f(r_cg_permutation->fp_ReflectFactor, rsurface.texture->reflectmax - rsurface.texture->reflectmin);CHECKCGERROR - if (r_cg_permutation->fp_ReflectOffset) cgGLSetParameter1f(r_cg_permutation->fp_ReflectOffset, rsurface.texture->reflectmin);CHECKCGERROR - if (r_cg_permutation->fp_SpecularPower) cgGLSetParameter1f(r_cg_permutation->fp_SpecularPower, rsurface.texture->specularpower * (r_shadow_glossexact.integer ? 0.25f : 1.0f));CHECKCGERROR - if (r_cg_permutation->fp_NormalmapScrollBlend) cgGLSetParameter2f(r_cg_permutation->fp_NormalmapScrollBlend, rsurface.texture->r_water_waterscroll[0], rsurface.texture->r_water_waterscroll[1]); - } - if (r_cg_permutation->fp_ShadowMap_TextureScale) cgGLSetParameter2f(r_cg_permutation->fp_ShadowMap_TextureScale, r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]);CHECKCGERROR - if (r_cg_permutation->fp_ShadowMap_Parameters) cgGLSetParameter4f(r_cg_permutation->fp_ShadowMap_Parameters, r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Glow) cgGLSetParameter3f(r_cg_permutation->fp_Color_Glow, rsurface.glowmod[0], rsurface.glowmod[1], rsurface.glowmod[2]);CHECKCGERROR - if (r_cg_permutation->fp_Alpha) cgGLSetParameter1f(r_cg_permutation->fp_Alpha, rsurface.texture->lightmapcolor[3] * ((rsurface.texture->basematerialflags & MATERIALFLAG_WATERSHADER && r_waterstate.enabled && !r_refdef.view.isoverlay) ? rsurface.texture->r_water_wateralpha : 1));CHECKCGERROR - if (r_cg_permutation->fp_EyePosition) cgGLSetParameter3f(r_cg_permutation->fp_EyePosition, rsurface.localvieworigin[0], rsurface.localvieworigin[1], rsurface.localvieworigin[2]);CHECKCGERROR - if (r_cg_permutation->fp_Color_Pants) - { - if (rsurface.texture->pantstexture) - cgGLSetParameter3f(r_cg_permutation->fp_Color_Pants, rsurface.colormap_pantscolor[0], rsurface.colormap_pantscolor[1], rsurface.colormap_pantscolor[2]); - else - cgGLSetParameter3f(r_cg_permutation->fp_Color_Pants, 0, 0, 0); - CHECKCGERROR - } - if (r_cg_permutation->fp_Color_Shirt) - { - if (rsurface.texture->shirttexture) - cgGLSetParameter3f(r_cg_permutation->fp_Color_Shirt, rsurface.colormap_shirtcolor[0], rsurface.colormap_shirtcolor[1], rsurface.colormap_shirtcolor[2]); - else - cgGLSetParameter3f(r_cg_permutation->fp_Color_Shirt, 0, 0, 0); - CHECKCGERROR - } - if (r_cg_permutation->fp_FogPlane) cgGLSetParameter4f(r_cg_permutation->fp_FogPlane, rsurface.fogplane[0], rsurface.fogplane[1], rsurface.fogplane[2], rsurface.fogplane[3]);CHECKCGERROR - if (r_cg_permutation->fp_FogPlaneViewDist) cgGLSetParameter1f(r_cg_permutation->fp_FogPlaneViewDist, rsurface.fogplaneviewdist);CHECKCGERROR - if (r_cg_permutation->fp_FogRangeRecip) cgGLSetParameter1f(r_cg_permutation->fp_FogRangeRecip, rsurface.fograngerecip);CHECKCGERROR - if (r_cg_permutation->fp_FogHeightFade) cgGLSetParameter1f(r_cg_permutation->fp_FogHeightFade, rsurface.fogheightfade);CHECKCGERROR - if (r_cg_permutation->fp_OffsetMapping_Scale) cgGLSetParameter1f(r_cg_permutation->fp_OffsetMapping_Scale, r_glsl_offsetmapping_scale.value);CHECKCGERROR - if (r_cg_permutation->fp_ScreenToDepth) cgGLSetParameter2f(r_cg_permutation->fp_ScreenToDepth, r_refdef.view.viewport.screentodepth[0], r_refdef.view.viewport.screentodepth[1]);CHECKCGERROR - if (r_cg_permutation->fp_PixelToScreenTexCoord) cgGLSetParameter2f(r_cg_permutation->fp_PixelToScreenTexCoord, 1.0f/vid.width, 1.0/vid.height);CHECKCGERROR - - // if (r_cg_permutation->fp_Texture_First ) CG_BindTexture(r_cg_permutation->fp_Texture_First , r_texture_white );CHECKCGERROR - // if (r_cg_permutation->fp_Texture_Second ) CG_BindTexture(r_cg_permutation->fp_Texture_Second , r_texture_white );CHECKCGERROR - // if (r_cg_permutation->fp_Texture_GammaRamps ) CG_BindTexture(r_cg_permutation->fp_Texture_GammaRamps , r_texture_gammaramps );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Normal ) CG_BindTexture(r_cg_permutation->fp_Texture_Normal , rsurface.texture->nmaptexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Color ) CG_BindTexture(r_cg_permutation->fp_Texture_Color , rsurface.texture->basetexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Gloss ) CG_BindTexture(r_cg_permutation->fp_Texture_Gloss , rsurface.texture->glosstexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Glow ) CG_BindTexture(r_cg_permutation->fp_Texture_Glow , rsurface.texture->glowtexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_SecondaryNormal) CG_BindTexture(r_cg_permutation->fp_Texture_SecondaryNormal, rsurface.texture->backgroundnmaptexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_SecondaryColor ) CG_BindTexture(r_cg_permutation->fp_Texture_SecondaryColor , rsurface.texture->backgroundbasetexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_SecondaryGloss ) CG_BindTexture(r_cg_permutation->fp_Texture_SecondaryGloss , rsurface.texture->backgroundglosstexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_SecondaryGlow ) CG_BindTexture(r_cg_permutation->fp_Texture_SecondaryGlow , rsurface.texture->backgroundglowtexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Pants ) CG_BindTexture(r_cg_permutation->fp_Texture_Pants , rsurface.texture->pantstexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Shirt ) CG_BindTexture(r_cg_permutation->fp_Texture_Shirt , rsurface.texture->shirttexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ReflectMask ) CG_BindTexture(r_cg_permutation->fp_Texture_ReflectMask , rsurface.texture->reflectmasktexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ReflectCube ) CG_BindTexture(r_cg_permutation->fp_Texture_ReflectCube , rsurface.texture->reflectcubetexture ? rsurface.texture->reflectcubetexture : r_texture_whitecube);CHECKCGERROR - if (r_cg_permutation->fp_Texture_FogHeightTexture) CG_BindTexture(r_cg_permutation->fp_Texture_FogHeightTexture, r_texture_fogheighttexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_FogMask ) CG_BindTexture(r_cg_permutation->fp_Texture_FogMask , r_texture_fogattenuation );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Lightmap ) CG_BindTexture(r_cg_permutation->fp_Texture_Lightmap , rsurface.lightmaptexture ? rsurface.lightmaptexture : r_texture_white);CHECKCGERROR - if (r_cg_permutation->fp_Texture_Deluxemap ) CG_BindTexture(r_cg_permutation->fp_Texture_Deluxemap , rsurface.deluxemaptexture ? rsurface.deluxemaptexture : r_texture_blanknormalmap);CHECKCGERROR - if (r_cg_permutation->fp_Texture_Attenuation ) CG_BindTexture(r_cg_permutation->fp_Texture_Attenuation , r_shadow_attenuationgradienttexture );CHECKCGERROR - if (rsurfacepass == RSURFPASS_BACKGROUND) - { - if (r_cg_permutation->fp_Texture_Refraction ) CG_BindTexture(r_cg_permutation->fp_Texture_Refraction , waterplane->texture_refraction ? waterplane->texture_refraction : r_texture_black);CHECKCGERROR - else if (r_cg_permutation->fp_Texture_First ) CG_BindTexture(r_cg_permutation->fp_Texture_First , waterplane->texture_camera ? waterplane->texture_camera : r_texture_black);CHECKCGERROR - if (r_cg_permutation->fp_Texture_Reflection ) CG_BindTexture(r_cg_permutation->fp_Texture_Reflection , waterplane->texture_reflection ? waterplane->texture_reflection : r_texture_black);CHECKCGERROR - } - else - { - if (r_cg_permutation->fp_Texture_Reflection ) CG_BindTexture(r_cg_permutation->fp_Texture_Reflection , waterplane->texture_reflection ? waterplane->texture_reflection : r_texture_black);CHECKCGERROR - } - if (r_cg_permutation->fp_Texture_ScreenDepth ) CG_BindTexture(r_cg_permutation->fp_Texture_ScreenDepth , r_shadow_prepassgeometrydepthtexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ScreenNormalMap) CG_BindTexture(r_cg_permutation->fp_Texture_ScreenNormalMap, r_shadow_prepassgeometrynormalmaptexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ScreenDiffuse ) CG_BindTexture(r_cg_permutation->fp_Texture_ScreenDiffuse , r_shadow_prepasslightingdiffusetexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ScreenSpecular ) CG_BindTexture(r_cg_permutation->fp_Texture_ScreenSpecular , r_shadow_prepasslightingspeculartexture );CHECKCGERROR - if (rsurface.rtlight || (r_shadow_usingshadowmaportho && !(rsurface.ent_flags & RENDER_NOSELFSHADOW))) - { - if (r_cg_permutation->fp_Texture_ShadowMap2D ) CG_BindTexture(r_cg_permutation->fp_Texture_ShadowMap2D , r_shadow_shadowmap2dtexture );CHECKCGERROR - if (rsurface.rtlight) - { - if (r_cg_permutation->fp_Texture_Cube ) CG_BindTexture(r_cg_permutation->fp_Texture_Cube , rsurface.rtlight->currentcubemap );CHECKCGERROR - if (r_cg_permutation->fp_Texture_CubeProjection ) CG_BindTexture(r_cg_permutation->fp_Texture_CubeProjection , r_shadow_shadowmapvsdcttexture );CHECKCGERROR - } - } - - CHECKGLERROR -#endif - break; case RENDERPATH_GL13: case RENDERPATH_GL11: break; @@ -6415,28 +5686,6 @@ void R_SetupShader_DeferredLight(const rtlight_t *rtlight) if (r_glsl_permutation->tex_Texture_ShadowMap2D >= 0) R_Mesh_TexBind(r_glsl_permutation->tex_Texture_ShadowMap2D , r_shadow_shadowmap2dtexture ); if (r_glsl_permutation->tex_Texture_CubeProjection >= 0) R_Mesh_TexBind(r_glsl_permutation->tex_Texture_CubeProjection , r_shadow_shadowmapvsdcttexture ); break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - R_SetupShader_SetPermutationCG(mode, permutation); - if (r_cg_permutation->fp_LightPosition ) cgGLSetParameter3f(r_cg_permutation->fp_LightPosition, viewlightorigin[0], viewlightorigin[1], viewlightorigin[2]);CHECKCGERROR - if (r_cg_permutation->fp_ViewToLight ) cgGLSetMatrixParameterfc(r_cg_permutation->fp_ViewToLight, viewtolight16f);CHECKCGERROR - if (r_cg_permutation->fp_DeferredColor_Ambient ) cgGLSetParameter3f(r_cg_permutation->fp_DeferredColor_Ambient , lightcolorbase[0] * ambientscale * range, lightcolorbase[1] * ambientscale * range, lightcolorbase[2] * ambientscale * range);CHECKCGERROR - if (r_cg_permutation->fp_DeferredColor_Diffuse ) cgGLSetParameter3f(r_cg_permutation->fp_DeferredColor_Diffuse , lightcolorbase[0] * diffusescale * range, lightcolorbase[1] * diffusescale * range, lightcolorbase[2] * diffusescale * range);CHECKCGERROR - if (r_cg_permutation->fp_DeferredColor_Specular ) cgGLSetParameter3f(r_cg_permutation->fp_DeferredColor_Specular, lightcolorbase[0] * specularscale * range, lightcolorbase[1] * specularscale * range, lightcolorbase[2] * specularscale * range);CHECKCGERROR - if (r_cg_permutation->fp_ShadowMap_TextureScale ) cgGLSetParameter2f(r_cg_permutation->fp_ShadowMap_TextureScale, r_shadow_shadowmap_texturescale[0], r_shadow_shadowmap_texturescale[1]);CHECKCGERROR - if (r_cg_permutation->fp_ShadowMap_Parameters ) cgGLSetParameter4f(r_cg_permutation->fp_ShadowMap_Parameters, r_shadow_shadowmap_parameters[0], r_shadow_shadowmap_parameters[1], r_shadow_shadowmap_parameters[2], r_shadow_shadowmap_parameters[3]);CHECKCGERROR - if (r_cg_permutation->fp_SpecularPower ) cgGLSetParameter1f(r_cg_permutation->fp_SpecularPower, (r_shadow_gloss.integer == 2 ? r_shadow_gloss2exponent.value : r_shadow_glossexponent.value) * (r_shadow_glossexact.integer ? 0.25f : 1.0f));CHECKCGERROR - if (r_cg_permutation->fp_ScreenToDepth ) cgGLSetParameter2f(r_cg_permutation->fp_ScreenToDepth, r_refdef.view.viewport.screentodepth[0], r_refdef.view.viewport.screentodepth[1]);CHECKCGERROR - if (r_cg_permutation->fp_PixelToScreenTexCoord ) cgGLSetParameter2f(r_cg_permutation->fp_PixelToScreenTexCoord, 1.0f/vid.width, 1.0/vid.height);CHECKCGERROR - - if (r_cg_permutation->fp_Texture_Attenuation ) CG_BindTexture(r_cg_permutation->fp_Texture_Attenuation , r_shadow_attenuationgradienttexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ScreenDepth ) CG_BindTexture(r_cg_permutation->fp_Texture_ScreenDepth , r_shadow_prepassgeometrydepthtexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ScreenNormalMap ) CG_BindTexture(r_cg_permutation->fp_Texture_ScreenNormalMap, r_shadow_prepassgeometrynormalmaptexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_Cube ) CG_BindTexture(r_cg_permutation->fp_Texture_Cube , rsurface.rtlight->currentcubemap );CHECKCGERROR - if (r_cg_permutation->fp_Texture_ShadowMap2D ) CG_BindTexture(r_cg_permutation->fp_Texture_ShadowMap2D , r_shadow_shadowmap2dtexture );CHECKCGERROR - if (r_cg_permutation->fp_Texture_CubeProjection ) CG_BindTexture(r_cg_permutation->fp_Texture_CubeProjection , r_shadow_shadowmapvsdcttexture );CHECKCGERROR -#endif - break; case RENDERPATH_GL13: case RENDERPATH_GL11: break; @@ -7299,7 +6548,6 @@ void gl_main_start(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -7370,11 +6618,6 @@ void gl_main_start(void) memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash)); Mem_ExpandableArray_NewArray(&r_glsl_permutationarray, r_main_mempool, sizeof(r_glsl_permutation_t), 256); glslshaderstring = NULL; -#ifdef SUPPORTCG - r_cg_permutation = NULL; - memset(r_cg_permutationhash, 0, sizeof(r_cg_permutationhash)); - Mem_ExpandableArray_NewArray(&r_cg_permutationarray, r_main_mempool, sizeof(r_cg_permutation_t), 256); -#endif #ifdef SUPPORTD3D r_hlsl_permutation = NULL; memset(r_hlsl_permutationhash, 0, sizeof(r_hlsl_permutationhash)); @@ -7398,7 +6641,6 @@ void gl_main_shutdown(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (r_maxqueries) qglDeleteQueriesARB(r_maxqueries, r_queries); @@ -7451,11 +6693,6 @@ void gl_main_shutdown(void) memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash)); Mem_ExpandableArray_FreeArray(&r_glsl_permutationarray); glslshaderstring = NULL; -#ifdef SUPPORTCG - r_cg_permutation = NULL; - memset(r_cg_permutationhash, 0, sizeof(r_cg_permutationhash)); - Mem_ExpandableArray_FreeArray(&r_cg_permutationarray); -#endif #ifdef SUPPORTD3D r_hlsl_permutation = NULL; memset(r_hlsl_permutationhash, 0, sizeof(r_hlsl_permutationhash)); @@ -8025,7 +7262,6 @@ void R_AnimCache_CacheVisibleEntities(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -8364,7 +7600,6 @@ static void R_View_SetFrustum(const int *scissor) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: // non-flipped y coordinates fny = -1.0 + 2.0 * (scissor[1] - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height); @@ -8611,13 +7846,6 @@ void R_EntityMatrix(const matrix4x4_t *matrix) case RENDERPATH_D3D11: Con_DPrintf("FIXME D3D11 shader %s:%i\n", __FILE__, __LINE__); break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - CHECKCGERROR - if (r_cg_permutation && r_cg_permutation->vp_ModelViewProjectionMatrix) cgGLSetMatrixParameterfc(r_cg_permutation->vp_ModelViewProjectionMatrix, gl_modelviewprojection16f);CHECKCGERROR - if (r_cg_permutation && r_cg_permutation->vp_ModelViewMatrix) cgGLSetMatrixParameterfc(r_cg_permutation->vp_ModelViewMatrix, gl_modelview16f);CHECKCGERROR -#endif - break; case RENDERPATH_GL13: case RENDERPATH_GL11: qglLoadMatrixf(gl_modelview16f);CHECKGLERROR @@ -8661,7 +7889,6 @@ void R_ResetViewRendering2D(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR break; @@ -8697,7 +7924,6 @@ void R_ResetViewRendering3D(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR break; @@ -8741,7 +7967,6 @@ static void R_Water_StartFrame(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -9108,7 +8333,6 @@ void R_Bloom_StartFrame(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -9213,7 +8437,6 @@ void R_Bloom_StartFrame(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -9257,7 +8480,6 @@ void R_Bloom_CopyBloomTexture(float colorscale) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_bloomstate.screentexcoord2f); @@ -9433,7 +8655,6 @@ static void R_BlendView(void) switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -9491,7 +8712,6 @@ static void R_BlendView(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_bloomstate.screentexcoord2f); @@ -9573,24 +8793,6 @@ static void R_BlendView(void) if (r_glsl_permutation->loc_PixelToScreenTexCoord >= 0) qglUniform2f(r_glsl_permutation->loc_PixelToScreenTexCoord, 1.0f/vid.width, 1.0f/vid.height); if (r_glsl_permutation->loc_BloomColorSubtract >= 0) qglUniform4f(r_glsl_permutation->loc_BloomColorSubtract , r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, 0.0f); break; - case RENDERPATH_CGGL: -#ifdef SUPPORTCG - R_Mesh_PrepareVertices_Mesh_Arrays(4, r_screenvertex3f, NULL, NULL, NULL, NULL, r_bloomstate.screentexcoord2f, r_bloomstate.bloomtexcoord2f); - R_SetupShader_SetPermutationCG(SHADERMODE_POSTPROCESS, permutation); - if (r_cg_permutation->fp_Texture_First ) CG_BindTexture(r_cg_permutation->fp_Texture_First , r_bloomstate.texture_screen);CHECKCGERROR - if (r_cg_permutation->fp_Texture_Second ) CG_BindTexture(r_cg_permutation->fp_Texture_Second , r_bloomstate.texture_bloom );CHECKCGERROR - if (r_cg_permutation->fp_Texture_GammaRamps) CG_BindTexture(r_cg_permutation->fp_Texture_GammaRamps, r_texture_gammaramps );CHECKCGERROR - if (r_cg_permutation->fp_ViewTintColor ) cgGLSetParameter4f( r_cg_permutation->fp_ViewTintColor , r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]);CHECKCGERROR - if (r_cg_permutation->fp_PixelSize ) cgGLSetParameter2f( r_cg_permutation->fp_PixelSize , 1.0/r_bloomstate.screentexturewidth, 1.0/r_bloomstate.screentextureheight);CHECKCGERROR - if (r_cg_permutation->fp_UserVec1 ) cgGLSetParameter4f( r_cg_permutation->fp_UserVec1 , uservecs[0][0], uservecs[0][1], uservecs[0][2], uservecs[0][3]);CHECKCGERROR - if (r_cg_permutation->fp_UserVec2 ) cgGLSetParameter4f( r_cg_permutation->fp_UserVec2 , uservecs[1][0], uservecs[1][1], uservecs[1][2], uservecs[1][3]);CHECKCGERROR - if (r_cg_permutation->fp_UserVec3 ) cgGLSetParameter4f( r_cg_permutation->fp_UserVec3 , uservecs[2][0], uservecs[2][1], uservecs[2][2], uservecs[2][3]);CHECKCGERROR - if (r_cg_permutation->fp_UserVec4 ) cgGLSetParameter4f( r_cg_permutation->fp_UserVec4 , uservecs[3][0], uservecs[3][1], uservecs[3][2], uservecs[3][3]);CHECKCGERROR - if (r_cg_permutation->fp_Saturation ) cgGLSetParameter1f( r_cg_permutation->fp_Saturation , r_glsl_saturation.value);CHECKCGERROR - if (r_cg_permutation->fp_PixelToScreenTexCoord) cgGLSetParameter2f(r_cg_permutation->fp_PixelToScreenTexCoord, 1.0f/vid.width, 1.0/vid.height);CHECKCGERROR - if (r_cg_permutation->fp_BloomColorSubtract ) cgGLSetParameter4f(r_cg_permutation->fp_BloomColorSubtract , r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, 0.0f); -#endif - break; case RENDERPATH_D3D9: #ifdef SUPPORTD3D // D3D has upside down Y coords, the easiest way to flip this is to flip the screen vertices rather than the texcoords, so we just use a different array for that... @@ -9781,7 +8983,6 @@ void R_UpdateVariables(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -13232,7 +12433,6 @@ static void R_DrawWorldTextureSurfaceList(int texturenumsurfaces, const msurface switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -13262,7 +12462,6 @@ static void R_DrawModelTextureSurfaceList(int texturenumsurfaces, const msurface switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -13301,7 +12500,6 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -14328,7 +13526,6 @@ void R_DrawDebugModel(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: break; case RENDERPATH_D3D9: //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); @@ -14630,7 +13827,6 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -14649,7 +13845,6 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: diff --git a/gl_textures.c b/gl_textures.c index 8122db46..62947bbd 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -302,7 +302,6 @@ void R_FreeTexture(rtexture_t *rt) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (glt->texnum) { @@ -456,7 +455,6 @@ static void GL_TextureMode_f (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: // change all the existing mipmap texture objects // FIXME: force renderer(/client/something?) restart instead? @@ -582,7 +580,6 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int miplevel, i case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D10: case RENDERPATH_D3D11: case RENDERPATH_SOFT: @@ -703,7 +700,6 @@ static void r_textures_start(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: // LordHavoc: allow any alignment CHECKGLERROR @@ -771,7 +767,6 @@ static void r_textures_devicelost(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -814,7 +809,6 @@ static void r_textures_devicerestored(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: break; case RENDERPATH_D3D9: @@ -925,7 +919,6 @@ void R_Textures_Frame (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR GL_ActiveTexture(0); @@ -1081,7 +1074,6 @@ static void R_UploadPartialTexture(gltexture_t *glt, const unsigned char *data, case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: { int oldbindtexnum; @@ -1194,7 +1186,6 @@ static void R_UploadFullTexture(gltexture_t *glt, const unsigned char *data) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR @@ -1617,7 +1608,6 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR @@ -2250,7 +2240,6 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR GL_ActiveTexture(0); @@ -2303,7 +2292,6 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (bytesperblock) { @@ -2360,7 +2348,6 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: if (dds_miplevels >= 1 && !mipcomplete) { diff --git a/makefile.inc b/makefile.inc index a1c0b17e..8fb3813e 100644 --- a/makefile.inc +++ b/makefile.inc @@ -29,10 +29,6 @@ CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-sig LIB_ODE=`[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && "$(DP_ODE_STATIC_LIBDIR)/../bin/ode-config" --libs` `[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && echo -lstdc++` CFLAGS_ODE=`[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && "$(DP_ODE_STATIC_LIBDIR)/../bin/ode-config" --cflags || { [ -n "$(DP_ODE_DYNAMIC)" ] && echo \ -DODE_DYNAMIC; }` `[ -n "$(DP_ODE_STATIC_LIBDIR)" ] && echo -DODE_STATIC` -# Additional stuff for libCg -LIB_CG= `[ -n "$(DP_CG_LIBDIR)" ] && echo \ -lCg\ -lCgGL -lGL` -CFLAGS_CG= `[ -n "$(DP_CG_LIBDIR)" ] && echo \ -DSUPPORTCG` - SDL_CONFIG?=sdl-config SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags` @@ -191,7 +187,7 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_SND_COMMON) snd_sdl. # Compilation -CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_CG) $(CFLAGS_WARNINGS) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) +CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) CFLAGS_DEBUG=-ggdb CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs CFLAGS_RELEASE= @@ -221,7 +217,7 @@ LDFLAGS_RELEASE=$(OPTIM_RELEASE) -DSVNREVISION=`test -d .svn && svnversion || ec OBJ_GLX= builddate.c sys_linux.o vid_glx.o thread_null.o keysym2ucs.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON) -LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_CG) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) +LDFLAGS_UNIXCOMMON=-lm $(LIB_ODE) $(LIB_JPEG) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND) LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -logg -ltheora -lvorbis -lvorbisenc -lvorbisfile -lcurl -lmodplug LDFLAGS_UNIXSV_PRELOAD=-lz -ljpeg -lpng -lcurl diff --git a/model_brush.c b/model_brush.c index 4f409875..df585323 100644 --- a/model_brush.c +++ b/model_brush.c @@ -5635,7 +5635,6 @@ static void Mod_Q3BSP_LightPoint(dp_model_t *model, const vec3_t p, vec3_t ambie switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: diff --git a/r_shadow.c b/r_shadow.c index 131ca659..ecba4b32 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -420,11 +420,7 @@ void R_Shadow_SetShadowMode(void) } } r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAP2D; - // Cg has very little choice in depth texture sampling - if (vid.cgcontext) - r_shadow_shadowmapsampler = false; break; - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -1897,7 +1893,6 @@ void R_Shadow_RenderMode_Begin(void) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -2106,7 +2101,6 @@ init_done: case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: GL_CullFace(r_refdef.view.cullface_back); @@ -2680,7 +2674,6 @@ void R_Shadow_RenderLighting(int texturenumsurfaces, const msurface_t **textures case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); break; @@ -2727,7 +2720,6 @@ void R_Shadow_RenderLighting(int texturenumsurfaces, const msurface_t **textures case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_ADD_EXT); break; @@ -3888,7 +3880,6 @@ void R_Shadow_PrepareLights(void) switch (vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -4285,7 +4276,6 @@ void R_DrawModelShadowMaps(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_SOFT: case RENDERPATH_GLES2: break; @@ -4463,7 +4453,6 @@ void R_BeginCoronaQuery(rtlight_t *rtlight, float scale, qboolean usequery) case RENDERPATH_GL20: case RENDERPATH_GL13: case RENDERPATH_GL11: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR // NOTE: GL_DEPTH_TEST must be enabled or ATI won't count samples, so use GL_DepthFunc instead @@ -4512,7 +4501,6 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) case RENDERPATH_GL20: case RENDERPATH_GL13: case RENDERPATH_GL11: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR qglGetQueryObjectivARB(rtlight->corona_queryindex_visiblepixels, GL_QUERY_RESULT_ARB, &visiblepixels); @@ -4557,7 +4545,6 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT); break; @@ -4587,7 +4574,6 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: qglBlendEquationEXT(GL_FUNC_ADD_EXT); break; @@ -4636,7 +4622,6 @@ void R_Shadow_DrawCoronas(void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: usequery = vid.support.arb_occlusion_query && r_coronas_occlusionquery.integer; if (usequery) diff --git a/vid.h b/vid.h index cb6775d6..157f1c0b 100644 --- a/vid.h +++ b/vid.h @@ -33,7 +33,6 @@ typedef enum renderpath_e RENDERPATH_GL11, RENDERPATH_GL13, RENDERPATH_GL20, - RENDERPATH_CGGL, RENDERPATH_D3D9, RENDERPATH_D3D10, RENDERPATH_D3D11, @@ -98,8 +97,6 @@ typedef struct viddef_s int samples; qboolean stencil; - void *cgcontext; - renderpath_t renderpath; qboolean forcevbo; // some renderpaths can not operate without it qboolean useinterleavedarrays; // required by some renderpaths diff --git a/vid_sdl.c b/vid_sdl.c index 4cd97d69..45d8bc77 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1924,7 +1924,6 @@ void VID_Finish (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_GLES2: CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) diff --git a/vid_shared.c b/vid_shared.c index 0db91b50..05c5bea5 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -2,10 +2,6 @@ #include "quakedef.h" #include "cdaudio.h" -#ifdef SUPPORTCG -#include -#endif - #ifdef SUPPORTD3D #include #ifdef _MSC_VER @@ -69,9 +65,6 @@ cvar_t vid_minwidth = {0, "vid_minwidth", "0", "minimum vid_width that is accept cvar_t vid_minheight = {0, "vid_minheight", "0", "minimum vid_height that is acceptable (to be set in default.cfg in mods)"}; cvar_t vid_gl13 = {0, "vid_gl13", "1", "enables faster rendering using OpenGL 1.3 features (such as GL_ARB_texture_env_combine extension)"}; cvar_t vid_gl20 = {0, "vid_gl20", "1", "enables faster rendering using OpenGL 2.0 features (such as GL_ARB_fragment_shader extension)"}; -#ifdef SUPPORTCG -cvar_t vid_cggl = {0, "vid_glcg", "1", "enables faster rendering using the Cg shader library"}; -#endif cvar_t gl_finish = {0, "gl_finish", "0", "make the cpu wait for the graphics processor at the end of each rendered frame (can help with strange input or video lag problems on some machines)"}; cvar_t vid_stick_mouse = {CVAR_SAVE, "vid_stick_mouse", "0", "have the mouse stuck in the center of the screen" }; @@ -931,17 +924,6 @@ void VID_CheckExtensions(void) vid.renderpath = RENDERPATH_GL20; vid.useinterleavedarrays = false; } -#ifdef SUPPORTCG - else if (vid_cggl.integer && (vid.cgcontext = cgCreateContext())) - { - vid.texunits = 4; - vid.teximageunits = 16; - vid.texarrayunits = 8; - Con_DPrintf("Using NVIDIA Cg rendering path - %i texture matrix, %i texture images, %i texcoords%s\n", vid.texunits, vid.teximageunits, vid.texarrayunits, vid.support.ext_framebuffer_object ? ", shadowmapping supported" : ""); - vid.renderpath = RENDERPATH_CGGL; - vid.useinterleavedarrays = false; - } -#endif else if (vid.support.arb_texture_env_combine && vid.texunits >= 2 && vid_gl13.integer) { qglGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&vid.texunits); @@ -1051,7 +1033,6 @@ void VID_UpdateGamma(qboolean force, int rampsize) switch(vid.renderpath) { case RENDERPATH_GL20: - case RENDERPATH_CGGL: case RENDERPATH_D3D9: case RENDERPATH_D3D10: case RENDERPATH_D3D11: @@ -1236,9 +1217,6 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_minheight); Cvar_RegisterVariable(&vid_gl13); Cvar_RegisterVariable(&vid_gl20); -#ifdef SUPPORTCG - Cvar_RegisterVariable(&vid_cggl); -#endif Cvar_RegisterVariable(&gl_finish); Cmd_AddCommand("force_centerview", Force_CenterView_f, "recenters view (stops looking up/down)"); Cmd_AddCommand("vid_restart", VID_Restart_f, "restarts video system (closes and reopens the window, restarts renderer)");