wined3d: Allow mix of SW vertex and GLSL pixel shader.

Do not attach non-GLSL shaders to the GLSL program, that will cause a
crash. Mix with ARB shaders is never going to happen, because the
selection code will always choose GLSL for both or ARB for both.
This commit is contained in:
Ivan Gyurdiev 2006-07-04 01:23:18 -06:00 committed by Alexandre Julliard
parent 771623692e
commit b324fc0fdb
1 changed files with 18 additions and 19 deletions

View File

@ -308,11 +308,17 @@ void set_glsl_shader_program(IWineD3DDevice *iface) {
TRACE_(d3d_shader)("Created new GLSL shader program %u\n", programId);
This->stateBlock->shaderPrgId = programId;
if (NULL != vshader) {
/* Allocate a new link for the list of programs */
newLink = HeapAlloc(GetProcessHeap(), 0, sizeof(struct glsl_shader_prog_link));
newLink->programId = programId;
/* Attach GLSL vshader */
if (NULL != vshader && wined3d_settings.vs_selected_mode == SHADER_GLSL) {
int i;
int max_attribs = 16; /* TODO: Will this always be the case? It is at the moment... */
char tmp_name[10];
TRACE("Attaching vertex shader to GLSL program\n");
attach_glsl_shader(iface, (IWineD3DBaseShader*)vshader);
/* Bind vertex attributes to a corresponding index number to match
@ -329,28 +335,21 @@ void set_glsl_shader_program(IWineD3DDevice *iface) {
GL_EXTCALL(glBindAttribLocationARB(programId, i, tmp_name));
}
checkGLcall("glBindAttribLocationARB");
newLink->vertexShader = vshader;
}
if (NULL != pshader) {
/* Attach GLSL pshader */
if (NULL != pshader && wined3d_settings.ps_selected_mode == SHADER_GLSL) {
TRACE("Attaching pixel shader to GLSL program\n");
attach_glsl_shader(iface, (IWineD3DBaseShader*)pshader);
newLink->pixelShader = pshader;
}
/* Link the program */
TRACE_(d3d_shader)("Linking GLSL shader program %u\n", programId);
GL_EXTCALL(glLinkProgramARB(programId));
print_glsl_info_log(&GLINFO_LOCATION, programId);
/* Now, we add a list item to associate this program with the vertex and
* pixel shaders that it is attached to.
*
* These list items will be deleted when the device is released.
*/
newLink = HeapAlloc(GetProcessHeap(), 0, sizeof(struct glsl_shader_prog_link));
newLink->programId = programId;
newLink->pixelShader = pshader;
newLink->vertexShader = vshader;
list_add_head( &This->glsl_shader_progs, &newLink->entry);
return;
}