Forráskód Böngészése

Remove destroyed sampler states from the current samplers list

Palana 11 éve
szülő
commit
12f0877ebc
2 módosított fájl, 18 hozzáadás és 0 törlés
  1. 9 0
      libobs-d3d11/d3d11-subsystem.cpp
  2. 9 0
      libobs-opengl/gl-subsystem.c

+ 9 - 0
libobs-d3d11/d3d11-subsystem.cpp

@@ -1641,6 +1641,15 @@ void zstencil_destroy(zstencil_t zstencil)
 
 void samplerstate_destroy(samplerstate_t samplerstate)
 {
+	if (!samplerstate)
+		return;
+
+	if (samplerstate->device)
+		for (int i = 0; i < GS_MAX_TEXTURES; i++)
+			if (samplerstate->device->curSamplers[i] ==
+					samplerstate)
+				samplerstate->device->curSamplers[i] = nullptr;
+
 	delete samplerstate;
 }
 

+ 9 - 0
libobs-opengl/gl-subsystem.c

@@ -1304,5 +1304,14 @@ enum gs_color_format volumetexture_getcolorformat(texture_t voltex)
 
 void samplerstate_destroy(samplerstate_t samplerstate)
 {
+	if (!samplerstate)
+		return;
+
+	if (samplerstate->device)
+		for (int i = 0; i < GS_MAX_TEXTURES; i++)
+			if (samplerstate->device->cur_samplers[i] ==
+					samplerstate)
+				samplerstate->device->cur_samplers[i] = NULL;
+
 	samplerstate_release(samplerstate);
 }