Module: wine Branch: master Commit: 42a9262acf4600c4eb5e5dd6831b80dd9aa9395d URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=42a9262acf4600c4eb5e5dd6...
Author: Ivan Gyurdiev ivg231@gmail.com Date: Wed Sep 27 07:15:58 2006 -0400
wined3d: Read GL info and load constants into the same device.
---
dlls/wined3d/arb_program_shader.c | 10 +++++----- dlls/wined3d/drawprim.c | 4 ++-- dlls/wined3d/glsl_shader.c | 13 +++++++------ dlls/wined3d/wined3d_private.h | 5 +++-- 4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 7e6231c..128f900 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -102,19 +102,19 @@ static void shader_arb_load_constantsF(I * worry about the Integers or Booleans */ void shader_arb_load_constants( - IWineD3DStateBlock* iface, + IWineD3DDevice* device, char usePixelShader, char useVertexShader) { - - IWineD3DStateBlockImpl* stateBlock = (IWineD3DStateBlockImpl*) iface; - WineD3D_GL_Info *gl_info = &((IWineD3DImpl*)stateBlock->wineD3DDevice->wineD3D)->gl_info; + + IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device; + IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; + WineD3D_GL_Info *gl_info = &((IWineD3DImpl*)deviceImpl->wineD3D)->gl_info;
if (useVertexShader) { IWineD3DBaseShaderImpl* vshader = (IWineD3DBaseShaderImpl*) stateBlock->vertexShader; IWineD3DVertexShaderImpl* vshader_impl = (IWineD3DVertexShaderImpl*) stateBlock->vertexShader; IWineD3DVertexDeclarationImpl* vertexDeclaration = (IWineD3DVertexDeclarationImpl*) vshader_impl->vertexDeclaration; - IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) vshader->baseShader.device;
if (NULL != vertexDeclaration && NULL != vertexDeclaration->constants) { /* Load DirectX 8 float constants for vertex shader */ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index c9b14a0..1160037 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -1852,9 +1852,9 @@ #undef BUFFER_OR_DATA
/* Load any global constants/uniforms that may have been set by the application */ if (wined3d_settings.vs_selected_mode == SHADER_GLSL || wined3d_settings.ps_selected_mode == SHADER_GLSL) - shader_glsl_load_constants((IWineD3DStateBlock*)This->stateBlock, usePixelShaderFunction, useVertexShaderFunction); + shader_glsl_load_constants(iface, usePixelShaderFunction, useVertexShaderFunction); else if (wined3d_settings.vs_selected_mode== SHADER_ARB || wined3d_settings.ps_selected_mode == SHADER_ARB) - shader_arb_load_constants((IWineD3DStateBlock*)This->stateBlock, usePixelShaderFunction, useVertexShaderFunction); + shader_arb_load_constants(iface, usePixelShaderFunction, useVertexShaderFunction);
/* Draw vertex-by-vertex */ if (useDrawStridedSlow) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 63d8bfd..b92cecb 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -269,12 +269,14 @@ void shader_glsl_load_constantsB( * Loads the app-supplied constants into the currently set GLSL program. */ void shader_glsl_load_constants( - IWineD3DStateBlock* iface, + IWineD3DDevice* device, char usePixelShader, char useVertexShader) { - - IWineD3DStateBlockImpl* stateBlock = (IWineD3DStateBlockImpl*) iface; - WineD3D_GL_Info *gl_info = &((IWineD3DImpl*)stateBlock->wineD3DDevice->wineD3D)->gl_info; + + IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device; + IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; + WineD3D_GL_Info *gl_info = &((IWineD3DImpl*) deviceImpl->wineD3D)->gl_info; + GLhandleARB *constant_locations; struct list *constant_list; GLhandleARB programId; @@ -288,7 +290,6 @@ void shader_glsl_load_constants( if (useVertexShader) { IWineD3DBaseShaderImpl* vshader = (IWineD3DBaseShaderImpl*) stateBlock->vertexShader; IWineD3DVertexShaderImpl* vshader_impl = (IWineD3DVertexShaderImpl*) vshader; - IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) vshader->baseShader.device; GLint pos;
IWineD3DVertexDeclarationImpl* vertexDeclaration = @@ -332,7 +333,7 @@ void shader_glsl_load_constants( constant_list = &stateBlock->set_pconstantsF;
/* Load pixel shader samplers */ - shader_glsl_load_psamplers(gl_info, iface); + shader_glsl_load_psamplers(gl_info, (IWineD3DStateBlock*) stateBlock);
/* Load DirectX 9 float constants/uniforms for pixel shader */ shader_glsl_load_constantsF(pshader, gl_info, GL_LIMITS(pshader_constantsF), diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 588f099..d2ee681 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1412,6 +1412,7 @@ typedef struct SHADER_OPCODE { } SHADER_OPCODE;
typedef struct SHADER_OPCODE_ARG { + IWineD3DStateBlock* stateBlock; IWineD3DBaseShader* shader; shader_reg_maps* reg_maps; CONST SHADER_OPCODE* opcode; @@ -1472,7 +1473,7 @@ extern HRESULT allocate_shader_constants
/* ARB_[vertex/fragment]_program helper functions */ extern void shader_arb_load_constants( - IWineD3DStateBlock* iface, + IWineD3DDevice* device, char usePixelShader, char useVertexShader);
@@ -1503,7 +1504,7 @@ extern void vshader_hw_mnxn(SHADER_OPCOD extern void set_glsl_shader_program(IWineD3DDevice *iface); extern void shader_glsl_add_instruction_modifiers(SHADER_OPCODE_ARG *arg); extern void shader_glsl_load_constants( - IWineD3DStateBlock* iface, + IWineD3DDevice* device, char usePixelShader, char useVertexShader);