]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed bug with toggling r_shadow_bouncegrid where the texture binding
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 7 Mar 2011 20:53:53 +0000 (20:53 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 7 Mar 2011 20:53:53 +0000 (20:53 +0000)
state was incorrect, causing bouncegrid to not work after being toggled
once

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10904 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
gl_backend.h
gl_textures.c
todo

index 3bbad6c8a549c42ea1a3aad3324b442377c42a7c..26fe7c2522c371170b79babdb701dfa73abfe7aa 100644 (file)
@@ -3371,6 +3371,23 @@ void R_Mesh_CopyToTexture(rtexture_t *tex, int tx, int ty, int sx, int sy, int w
 int d3drswrap[16] = {D3DRS_WRAP0, D3DRS_WRAP1, D3DRS_WRAP2, D3DRS_WRAP3, D3DRS_WRAP4, D3DRS_WRAP5, D3DRS_WRAP6, D3DRS_WRAP7, D3DRS_WRAP8, D3DRS_WRAP9, D3DRS_WRAP10, D3DRS_WRAP11, D3DRS_WRAP12, D3DRS_WRAP13, D3DRS_WRAP14, D3DRS_WRAP15};
 #endif
 
+void R_Mesh_ClearBindingsForTexture(int texnum)
+{
+       gltextureunit_t *unit;
+       unsigned int unitnum;
+       // this doesn't really unbind the texture, but it does prevent a mistaken "do nothing" behavior on the next time this same texnum is bound on the same unit as the same type (this mainly affects r_shadow_bouncegrid because 3D textures are so rarely used)
+       for (unitnum = 0;unitnum < vid.teximageunits;unitnum++)
+       {
+               unit = gl_state.units + unitnum;
+               if (unit->t2d == texnum)
+                       unit->t2d = -1;
+               if (unit->t3d == texnum)
+                       unit->t3d = -1;
+               if (unit->tcubemap == texnum)
+                       unit->tcubemap = -1;
+       }
+}
+
 void R_Mesh_TexBind(unsigned int unitnum, rtexture_t *tex)
 {
        gltextureunit_t *unit = gl_state.units + unitnum;
index fb634492045fb1e5aa2666642f05e5dc5d302b16..3997fa2643af15667e5864e25ab65bf25b54eddf 100644 (file)
@@ -107,6 +107,8 @@ void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix);
 void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, int rgbscale, int alphascale);
 // set up a blank texture state (unbinds all textures, texcoord pointers, and resets combine settings)
 void R_Mesh_ResetTextureState(void);
+// before a texture is freed, make sure there are no references to it
+void R_Mesh_ClearBindingsForTexture(int texnum);
 
 // renders a mesh
 void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtriangles, const int *element3i, const r_meshbuffer_t *element3i_indexbuffer, size_t element3i_bufferoffset, const unsigned short *element3s, const r_meshbuffer_t *element3s_indexbuffer, size_t element3s_bufferoffset);
index 0f08b5f9ea3df9047df57644a6861c286cb30425..134d514f2b31cecad88fd7e2e1642f49c3f1760c 100644 (file)
@@ -297,6 +297,8 @@ void R_FreeTexture(rtexture_t *rt)
        else
                Host_Error("R_FreeTexture: texture \"%s\" not linked in pool", glt->identifier);
 
+       R_Mesh_ClearBindingsForTexture(glt->texnum);
+
        switch(vid.renderpath)
        {
        case RENDERPATH_GL11:
diff --git a/todo b/todo
index ed03a343acbe74166d75f988950cab140f767995..3ed03b1de2ddbc0f487e29e269a3ea9d21107d44 100644 (file)
--- a/todo
+++ b/todo
@@ -1,12 +1,6 @@
 - todo: difficulty ratings are: 0 = trivial, 1 = easy, 2 = easy-moderate, 3 = moderate, 4 = moderate-hard, 5 = hard, 6 = hard++, 7 = nightmare, d = done, -d = done but have not notified the people who asked for it, f = failed, -f = failed but have not notified the people who asked for it
-0 bug darkplaces qw: tf skins not working (xavior)
-0 bug darkplaces renderer: rtworld seems to mess up player pants/shirt colors
-0 bug darkplaces d3d9: drawsetcliparea not working right (VorteX)
-0 bug darkplaces d3d9: shadowmaps are clipped - does this mean r_shadows 2 or light shadowmaps? (VorteX)
-0 bug darkplaces d3d9: overbright particles get weird colors (VorteX)
-0 bug darkplaces d3d9: gamma not working (VorteX)
-0 bug darkplaces d3d9: alphatest not working (VorteX)
-0 bug darkplaces renderer: sprites with ! in the filename are supposed to receive lighting (Asaki)
+-d bug darkplaces d3d9: drawsetcliparea not working right - seems to be Y-flipped, this also affects menus in Steelstorm (VorteX)
+-d bug darkplaces d3d9: overbright particles get weird colors (VorteX)
 0 bug darkplaces client csqc: CSQC_InputEvent is supposed to handle mouse movement, compare to FTEQW code (avirox)
 0 bug darkplaces client csqc: engine prediction function is not implemented - could just return the engine's current cl.movement_origin (Spike)
 0 bug darkplaces client csqc: entities not being drawn with VF_PERSPECTIVE 0? (daemon)
@@ -30,6 +24,9 @@
 0 bug darkplaces client win32: add some kind of workaround for Windows Firewall prompt killing the OpenGL context (motorsep)
 0 bug darkplaces client: can't move mouse around in nexuiz menu if vid_mouse is 0
 0 bug darkplaces client: if you press 1 during the demo loop when quake starts, escape doesn't do anything until you hit some other key (daemon)
+0 bug darkplaces d3d9: alphatest not working (VorteX)
+0 bug darkplaces d3d9: gamma not working (VorteX)
+0 bug darkplaces d3d9: shadowmaps are clipped - does this mean r_shadows 2 or light shadowmaps? (VorteX)
 0 bug darkplaces effects: add a cvar to disable colored dlights (leileilol)
 0 bug darkplaces effects: dlights don't look anything like quake ones, bring back lightmap dlights as a cvar - with both classic and old dp falloff modes (leileilol)
 0 bug darkplaces effects: quake mode blood trails don't have the appropriate slight gravity - there may be other effects missing this also (leileilol)
@@ -39,6 +36,7 @@
 0 bug darkplaces loader: png loading crashes if the image is transparent (Urre)
 0 bug darkplaces loader: q1bsp loader computes wrong submodel size for submodels with no surfaces, such as a func_wall comprised entirely of SKIP or CAULK brushes (neg|ke)
 0 bug darkplaces memory: memstats doesn't account for memory used by VBO/EBO buffers in models
+0 bug darkplaces qw: tf skins not working (xavior)
 0 bug darkplaces readme: it would be a very good idea to add documentation of sv_gameplayfix_* cvars in the readme as a means to run broken mods (xaGe)
 0 bug darkplaces readme: readme says that q3 shaders are not supported, this is not true, describe the working features in detail (qqshka)
 0 bug darkplaces renderer: GL13 path has broken handling of unlit surfaces in Nexuiz toxic.bsp - the small red light surfaces are black in GL13 path (m0rfar)
@@ -46,6 +44,8 @@
 0 bug darkplaces renderer: if an animated model has transparent surfaces, each one calls RSurf_ActiveModelEntity, recomputing all vertices
 0 bug darkplaces renderer: if an animated model is entirely transparent, the RSurf_ActiveModelEntity call updating vertices is completely wasted
 0 bug darkplaces renderer: r_speeds counts entities twice with r_hdr 1, the whole counting code probably needs auditing (Morphed, and jim on inside3d)
+0 bug darkplaces renderer: rtworld seems to mess up player pants/shirt colors
+0 bug darkplaces renderer: sprites with ! in the filename are supposed to receive lighting (Asaki)
 0 bug darkplaces server csqc networking: csqc entity sending code does not currently detect packet loss and repeat lost entities (FrikaC, Chris Page, div0)
 0 bug darkplaces server qc: trace_dphittexturename should be a static buffer rather than a tempstring, it produces unnecessary warnings currently (div0)
 0 bug darkplaces server: SV_PushMove is ignoring model type in its angles_x handling, where as the renderer checks only model type to determine angles_x handling (Urre)
@@ -567,6 +567,7 @@ d bug darkplaces csqc: network entity positions seem to be incorrectly updated w
 d bug darkplaces csqc: when playing back a demo, the csqc does not seem to be getting the cl.viewangles right
 d bug darkplaces docs: host_maxfps is gone, correct the darkplaces.txt and host.c cvar description for host_framerate
 d bug darkplaces general: make all text parsing routines support Mac newlines; \r with no \n (Zenex)
+d bug darkplaces gl: turning r_shadow_bouncegrid off and back on left a messed up texture binding state
 d bug darkplaces hud: sometimes texture borders wrap, causing annoying seams at the edges of pics, use TEXF_CLAMP
 d bug darkplaces init: only print "Playing shareware version." notice if running GAME_QUAKE (MrBIOS)
 d bug darkplaces input: buttons 4 and 5 on a mouse are acting like mwheel (Kedhrin)