Commit 42a9262a authored by Ivan Gyurdiev's avatar Ivan Gyurdiev Committed by Alexandre Julliard

wined3d: Read GL info and load constants into the same device.

parent d0032a1a
......@@ -102,19 +102,19 @@ static void shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, WineD3D_GL_
* 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 */
......
......@@ -1852,9 +1852,9 @@ inline static void drawPrimitiveDrawStrided(
/* 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)
......
......@@ -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),
......
......@@ -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(IWineD3DStateBlockImpl* object);
/* 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_OPCODE_ARG* arg);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment