Browse Source

d3d11: Fix bug creating static vertex buffers

The vertex data wasn't getting properly freed, it was actually setting
the parameter itself to null for some reason.
jp9000 11 years ago
parent
commit
f37c510f10
2 changed files with 4 additions and 4 deletions
  1. 2 0
      libobs-d3d11/d3d11-subsystem.hpp
  2. 2 4
      libobs-d3d11/d3d11-vertexbuffer.cpp

+ 2 - 0
libobs-d3d11/d3d11-subsystem.hpp

@@ -169,6 +169,8 @@ static inline D3D11_PRIMITIVE_TOPOLOGY ConvertGSTopology(gs_draw_mode mode)
 struct VBDataPtr {
 	vb_data *data;
 
+	inline void Clear() {vbdata_destroy(data); data = nullptr;}
+
 	inline VBDataPtr(vb_data *data) : data(data) {}
 	inline ~VBDataPtr() {vbdata_destroy(data);}
 };

+ 2 - 4
libobs-d3d11/d3d11-vertexbuffer.cpp

@@ -136,8 +136,6 @@ gs_vertex_buffer::gs_vertex_buffer(device_t device, struct vb_data *data,
 		uvSizes.push_back(tverts->width * sizeof(float));
 	}
 
-	if (!dynamic) {
-		bfree(data);
-		data = NULL;
-	}
+	if (!dynamic)
+		vbd.Clear();
 }