From 9fd5aef588dd7f5eaf5896517725a28b9aac9981 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 22 Jan 2013 11:28:19 +0000 Subject: [PATCH] fix r_depthfirst 2 with r_glsl_skeletal 1 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11884 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=4898dc79f6400a5d45db710614b4d6c9338d26a4 --- gl_rmain.c | 10 +++++++--- gl_rsurf.c | 1 - r_shadow.c | 6 +++--- render.h | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index ef397326..06922c1d 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1994,13 +1994,16 @@ void R_SetupShader_Generic_NoTexture(qboolean usegamma, qboolean notrippy) R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, usegamma, notrippy, false); } -void R_SetupShader_DepthOrShadow(qboolean notrippy, qboolean depthrgb) +void R_SetupShader_DepthOrShadow(qboolean notrippy, qboolean depthrgb, qboolean skeletal) { unsigned int permutation = 0; if (r_trippy.integer && !notrippy) permutation |= SHADERPERMUTATION_TRIPPY; if (depthrgb) permutation |= SHADERPERMUTATION_DEPTHRGB; + if (skeletal) + permutation |= SHADERPERMUTATION_SKELETAL; + if (vid.allowalphatocoverage) GL_AlphaToCoverage(false); switch (vid.renderpath) @@ -10192,7 +10195,7 @@ static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, const msurface_ R_Mesh_ResetTextureState(); if (skyrendermasked) { - R_SetupShader_DepthOrShadow(false, false); + R_SetupShader_DepthOrShadow(false, false, false); // depth-only (masking) GL_ColorMask(0,0,0,0); // just to make sure that braindead drivers don't draw @@ -10812,10 +10815,10 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const GL_BlendFunc(GL_ONE, GL_ZERO); GL_DepthMask(true); // R_Mesh_ResetTextureState(); - R_SetupShader_DepthOrShadow(false, false); } RSurf_SetupDepthAndCulling(); RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ALLOWMULTIDRAW, texturenumsurfaces, texturesurfacelist); + R_SetupShader_DepthOrShadow(false, false, !!rsurface.batchskeletaltransform3x4); if (rsurface.batchvertex3fbuffer) R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer); else @@ -10915,6 +10918,7 @@ static void R_DrawTextureSurfaceList_DepthOnly(int texturenumsurfaces, const msu R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3fbuffer); else R_Mesh_PrepareVertices_Vertex3f(rsurface.batchnumvertices, rsurface.batchvertex3f, rsurface.batchvertex3f_vertexbuffer); + R_SetupShader_DepthOrShadow(false, false, !!rsurface.batchskeletaltransform3x4); RSurf_DrawBatch(); } diff --git a/gl_rsurf.c b/gl_rsurf.c index 947f4146..d99aea92 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -645,7 +645,6 @@ void R_Q1BSP_DrawDepth(entity_render_t *ent) GL_BlendFunc(GL_ONE, GL_ZERO); GL_DepthMask(true); // R_Mesh_ResetTextureState(); - R_SetupShader_DepthOrShadow(false, false); if (ent == r_refdef.scene.worldentity) R_DrawWorldSurfaces(false, false, true, false, false); else diff --git a/r_shadow.c b/r_shadow.c index 1e223519..baf69f52 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2076,7 +2076,7 @@ void R_Shadow_RenderMode_StencilShadowVolumes(qboolean zpass) GL_ColorMask(0, 0, 0, 0); GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR GL_CullFace(GL_NONE); - R_SetupShader_DepthOrShadow(false, false); + R_SetupShader_DepthOrShadow(false, false, false); // FIXME test if we have a skeletal model? r_shadow_rendermode = mode; switch(mode) { @@ -2173,7 +2173,7 @@ static void R_Shadow_RenderMode_ShadowMap(int side, int clear, int size) R_Mesh_SetRenderTargets(fbo2d, r_shadow_shadowmap2ddepthbuffer, r_shadow_shadowmap2ddepthtexture, NULL, NULL, NULL); else R_Mesh_SetRenderTargets(fbo2d, r_shadow_shadowmap2ddepthtexture, NULL, NULL, NULL, NULL); - R_SetupShader_DepthOrShadow(true, r_shadow_shadowmap2ddepthbuffer != NULL); + R_SetupShader_DepthOrShadow(true, r_shadow_shadowmap2ddepthbuffer != NULL, false); // FIXME test if we have a skeletal model? GL_PolygonOffset(r_shadow_shadowmapping_polygonfactor.value, r_shadow_shadowmapping_polygonoffset.value); GL_DepthMask(true); GL_DepthTest(true); @@ -4843,7 +4843,7 @@ void R_DrawModelShadowMaps(int fbo, rtexture_t *depthtexture, rtexture_t *colort R_Mesh_SetRenderTargets(shadowfbo, r_shadow_shadowmap2ddepthbuffer, r_shadow_shadowmap2ddepthtexture, NULL, NULL, NULL); else R_Mesh_SetRenderTargets(shadowfbo, r_shadow_shadowmap2ddepthtexture, NULL, NULL, NULL, NULL); - R_SetupShader_DepthOrShadow(true, r_shadow_shadowmap2ddepthbuffer != NULL); + R_SetupShader_DepthOrShadow(true, r_shadow_shadowmap2ddepthbuffer != NULL, false); // FIXME test if we have a skeletal model? GL_PolygonOffset(r_shadow_shadowmapping_polygonfactor.value, r_shadow_shadowmapping_polygonoffset.value); GL_DepthMask(true); GL_DepthTest(true); diff --git a/render.h b/render.h index 4b353f70..fef5d46f 100644 --- a/render.h +++ b/render.h @@ -471,7 +471,7 @@ rsurfacepass_t; void R_SetupShader_Generic(rtexture_t *first, rtexture_t *second, int texturemode, int rgbscale, qboolean usegamma, qboolean notrippy, qboolean suppresstexalpha); void R_SetupShader_Generic_NoTexture(qboolean usegamma, qboolean notrippy); -void R_SetupShader_DepthOrShadow(qboolean notrippy, qboolean depthrgb); +void R_SetupShader_DepthOrShadow(qboolean notrippy, qboolean depthrgb, qboolean skeletal); void R_SetupShader_ShowDepth(qboolean notrippy); void R_SetupShader_Surface(const vec3_t lightcolorbase, qboolean modellighting, float ambientscale, float diffusescale, float specularscale, rsurfacepass_t rsurfacepass, int texturenumsurfaces, const msurface_t **texturesurfacelist, void *waterplane, qboolean notrippy); void R_SetupShader_DeferredLight(const rtlight_t *rtlight); -- 2.39.2