From 44b4777972030fe1b9e20faa21c4f65f04e42c1d Mon Sep 17 00:00:00 2001 From: Oliver Stieber Date: Tue, 11 Oct 2005 20:27:54 +0000 Subject: [PATCH] Add checks for ARB_vertex_program before allowing vertex shaders to use ARB_vertex_program. --- dlls/wined3d/drawprim.c | 8 +++++++- dlls/wined3d/vertexshader.c | 30 ++++++++++++++++-------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index b4b67240f91..7302dac3432 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -1949,7 +1949,13 @@ void drawPrimitive(IWineD3DDevice *iface, Direct3DVertexStridedData dataLocations; int useHW = FALSE; - useVertexShaderFunction = This->stateBlock->vertexShader != NULL ? wined3d_settings.vs_mode != VS_NONE ? ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->function != NULL ? TRUE: FALSE : FALSE : FALSE; + if (This->stateBlock->vertexShader != NULL && wined3d_settings.vs_mode != VS_NONE + &&((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->function != NULL + && GL_SUPPORT(ARB_VERTEX_PROGRAM)) { + useVertexShaderFunction = TRUE; + } else { + useVertexShaderFunction = FALSE; + } if (This->stateBlock->vertexDecl == NULL) { /* Work out what the FVF should look like */ diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c index e8c6b58d46d..9ee636e8583 100644 --- a/dlls/wined3d/vertexshader.c +++ b/dlls/wined3d/vertexshader.c @@ -1614,23 +1614,25 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS PNSTRCAT(pgmStr, tmpLine); } -/* finally null terminate the pgmStr*/ + /* finally null terminate the pgmStr*/ pgmStr[pgmLength] = 0; - /* Create the hw shader */ - /* TODO: change to resource.glObjectHandel or something like that */ - GL_EXTCALL(glGenProgramsARB(1, &This->prgId)); - TRACE("Creating a hw vertex shader, prg=%d\n", This->prgId); - GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, This->prgId)); + /* Check that Vertex Shaders are supported */ + if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) { + /* Create the hw shader */ + /* TODO: change to resource.glObjectHandel or something like that */ + GL_EXTCALL(glGenProgramsARB(1, &This->prgId)); + TRACE("Creating a hw vertex shader, prg=%d\n", This->prgId); + GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, This->prgId)); - - /* Create the program and check for errors */ - GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(pgmStr)/*pgmLength*/, pgmStr)); - if (glGetError() == GL_INVALID_OPERATION) { - GLint errPos; - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos); - FIXME("HW VertexShader Error at position: %d\n%s\n", errPos, glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - This->prgId = -1; + /* Create the program and check for errors */ + GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(pgmStr)/*pgmLength*/, pgmStr)); + if (glGetError() == GL_INVALID_OPERATION) { + GLint errPos; + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos); + FIXME("HW VertexShader Error at position: %d\n%s\n", errPos, glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + This->prgId = -1; + } } #if 1 /* if were using the data buffer of device then we don't need to free it */ HeapFree(GetProcessHeap(), 0, pgmStr);