Add checks for ARB_vertex_program before allowing vertex shaders to

use ARB_vertex_program.
This commit is contained in:
Oliver Stieber 2005-10-11 20:27:54 +00:00 committed by Alexandre Julliard
parent 18517ca56f
commit 44b4777972
2 changed files with 23 additions and 15 deletions

View File

@ -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 */

View File

@ -1614,16 +1614,17 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
PNSTRCAT(pgmStr, tmpLine);
}
/* finally null terminate the pgmStr*/
/* finally null terminate the pgmStr*/
pgmStr[pgmLength] = 0;
/* 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) {
@ -1632,6 +1633,7 @@ inline static VOID IWineD3DVertexShaderImpl_GenerateProgramArbHW(IWineD3DVertexS
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);
#endif