mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-25 01:01:15 +00:00
Fix OSD crash bug within CUDA & CL compute modules :
- remove the GL error check in cudaGLVertexBuffer : * unrelated GL errors left on the stack were triggering erroneous vertexBuffer allocation errors * we should not be checking for GL errors here anyway (as most other buffer allocations aren't checked either) - add some pointer checking in the GL / D3D drawContexts in case the vertexBuffer pointers passed are NULL - add some additional typedefs in OsdError to report some of the new CUDA / GL related errors
This commit is contained in:
parent
f22c717e1c
commit
d03a04d088
@ -944,8 +944,6 @@ bindProgram(Effect effect, OpenSubdiv::OsdPatchArray const & patch)
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
checkGLErrors("bindProgram leave");
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include <cuda_gl_interop.h>
|
||||
|
||||
#include "../osd/cudaGLVertexBuffer.h"
|
||||
#include "../osd/error.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@ -88,6 +89,7 @@ OsdCudaGLVertexBuffer::Create(int numElements, int numVertices) {
|
||||
OsdCudaGLVertexBuffer *instance =
|
||||
new OsdCudaGLVertexBuffer(numElements, numVertices);
|
||||
if (instance->allocate()) return instance;
|
||||
OsdError(OSD_CUDA_GL_ERROR,"OsdCudaGLVertexBuffer::Create failed.\n");
|
||||
delete instance;
|
||||
return NULL;
|
||||
}
|
||||
@ -131,15 +133,13 @@ OsdCudaGLVertexBuffer::allocate() {
|
||||
|
||||
int size = _numElements * _numVertices * sizeof(float);
|
||||
GLint prev = 0;
|
||||
|
||||
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &prev);
|
||||
glGenBuffers(1, &_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, size, 0, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, prev);
|
||||
|
||||
if (glGetError() != GL_NO_ERROR) return false;
|
||||
|
||||
// register vbo as cuda resource
|
||||
cudaError_t err = cudaGraphicsGLRegisterBuffer(
|
||||
&_cudaResource, _vbo, cudaGraphicsMapFlagsNone);
|
||||
|
@ -87,6 +87,9 @@ public:
|
||||
ID3D11DeviceContext *pd3d11DeviceContext,
|
||||
bool requirePtexCoordinates = false,
|
||||
bool requireFVarData = false) {
|
||||
|
||||
if (not vertexBuffer)
|
||||
return NULL;
|
||||
|
||||
OsdD3D11DrawContext * instance = new OsdD3D11DrawContext();
|
||||
if (instance->allocate(farMesh,
|
||||
|
@ -70,6 +70,8 @@ typedef enum {
|
||||
OSD_CL_PROGRAM_BUILD_ERROR,
|
||||
OSD_CL_KERNEL_CREATE_ERROR,
|
||||
OSD_CL_RUNTIME_ERROR,
|
||||
OSD_CUDA_GL_ERROR,
|
||||
OSD_GL_ERROR,
|
||||
OSD_GLSL_COMPILE_ERROR,
|
||||
OSD_GLSL_LINK_ERROR,
|
||||
OSD_D3D11_COMPILE_ERROR,
|
||||
|
@ -93,6 +93,9 @@ public:
|
||||
bool requirePtexCoordinates=false,
|
||||
bool requireFVarData=false) {
|
||||
|
||||
if (not vertexBuffer)
|
||||
return NULL;
|
||||
|
||||
OsdGLDrawContext * instance = new OsdGLDrawContext();
|
||||
if (instance->allocate(farMesh,
|
||||
vertexBuffer->BindVBO(),
|
||||
|
Loading…
Reference in New Issue
Block a user