wined3d: Explicitly pass the context to the shader_load_constants() handlers.
This commit is contained in:
parent
a7251f0f4e
commit
03686cb6bd
|
@ -530,33 +530,28 @@ static inline void shader_arb_vs_local_constants(IWineD3DDeviceImpl* deviceImpl)
|
|||
* worry about the Integers or Booleans
|
||||
*/
|
||||
/* GL locking is done by the caller (state handler) */
|
||||
static void shader_arb_load_constants(
|
||||
IWineD3DDevice* device,
|
||||
char usePixelShader,
|
||||
char useVertexShader) {
|
||||
|
||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
|
||||
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
|
||||
const struct wined3d_context *context = context_get_current();
|
||||
static void shader_arb_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
|
||||
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
if (useVertexShader) {
|
||||
IWineD3DBaseShaderImpl* vshader = (IWineD3DBaseShaderImpl*) stateBlock->vertexShader;
|
||||
|
||||
/* Load DirectX 9 float constants for vertex shader */
|
||||
deviceImpl->highest_dirty_vs_const = shader_arb_load_constantsF(vshader, gl_info, GL_VERTEX_PROGRAM_ARB,
|
||||
deviceImpl->highest_dirty_vs_const, stateBlock->vertexShaderConstantF, context->vshader_const_dirty);
|
||||
|
||||
shader_arb_vs_local_constants(deviceImpl);
|
||||
device->highest_dirty_vs_const = shader_arb_load_constantsF(vshader, gl_info, GL_VERTEX_PROGRAM_ARB,
|
||||
device->highest_dirty_vs_const, stateBlock->vertexShaderConstantF, context->vshader_const_dirty);
|
||||
shader_arb_vs_local_constants(device);
|
||||
}
|
||||
|
||||
if (usePixelShader) {
|
||||
IWineD3DBaseShaderImpl* pshader = (IWineD3DBaseShaderImpl*) stateBlock->pixelShader;
|
||||
|
||||
/* Load DirectX 9 float constants for pixel shader */
|
||||
deviceImpl->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
|
||||
deviceImpl->highest_dirty_ps_const, stateBlock->pixelShaderConstantF, context->pshader_const_dirty);
|
||||
shader_arb_ps_local_constants(deviceImpl);
|
||||
device->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
|
||||
device->highest_dirty_ps_const, stateBlock->pixelShaderConstantF, context->pshader_const_dirty);
|
||||
shader_arb_ps_local_constants(device);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4257,7 +4252,7 @@ static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
|
|||
context->pshader_const_dirty[i] = 1;
|
||||
}
|
||||
/* Also takes care of loading local constants */
|
||||
shader_arb_load_constants(iface, TRUE, FALSE);
|
||||
shader_arb_load_constants(context, TRUE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1371,7 +1371,7 @@ static void shader_none_select_depth_blt(IWineD3DDevice *iface, enum tex_types t
|
|||
static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
|
||||
static void shader_none_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) {}
|
||||
static void shader_none_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) {}
|
||||
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
|
||||
static void shader_none_load_constants(const struct wined3d_context *context, char usePS, char useVS) {}
|
||||
static void shader_none_load_np2fixup_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
|
||||
static void shader_none_destroy(IWineD3DBaseShader *iface) {}
|
||||
static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
|
||||
|
|
|
@ -627,13 +627,13 @@ static void shader_glsl_load_np2fixup_constants(
|
|||
* Loads the app-supplied constants into the currently set GLSL program.
|
||||
*/
|
||||
/* GL locking is done by the caller (state handler) */
|
||||
static void shader_glsl_load_constants(IWineD3DDevice *device, char usePixelShader, char useVertexShader)
|
||||
static void shader_glsl_load_constants(const struct wined3d_context *context,
|
||||
char usePixelShader, char useVertexShader)
|
||||
{
|
||||
const struct wined3d_context *context = context_get_current();
|
||||
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
|
||||
struct shader_glsl_priv *priv = deviceImpl->shader_priv;
|
||||
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
|
||||
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
|
||||
struct shader_glsl_priv *priv = device->shader_priv;
|
||||
|
||||
GLhandleARB programId;
|
||||
struct glsl_shader_prog_link *prog = priv->glsl_program;
|
||||
|
@ -663,7 +663,7 @@ static void shader_glsl_load_constants(IWineD3DDevice *device, char usePixelShad
|
|||
stateBlock->changed.vertexShaderConstantsB & vshader->baseShader.reg_maps.boolean_constants);
|
||||
|
||||
/* Upload the position fixup params */
|
||||
GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, &deviceImpl->posFixup[0]));
|
||||
GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, &device->posFixup[0]));
|
||||
checkGLcall("glUniform4fvARB");
|
||||
}
|
||||
|
||||
|
@ -718,7 +718,7 @@ static void shader_glsl_load_constants(IWineD3DDevice *device, char usePixelShad
|
|||
correction_params[1] = 1.0f;
|
||||
} else {
|
||||
/* position is window relative, not viewport relative */
|
||||
correction_params[0] = ((IWineD3DSurfaceImpl *) deviceImpl->render_targets[0])->currentDesc.Height;
|
||||
correction_params[0] = ((IWineD3DSurfaceImpl *)context->current_rt)->currentDesc.Height;
|
||||
correction_params[1] = -1.0f;
|
||||
}
|
||||
GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params));
|
||||
|
|
|
@ -3361,7 +3361,7 @@ static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
|
|||
return;
|
||||
}
|
||||
|
||||
device->shader_backend->shader_load_constants((IWineD3DDevice *)device, use_ps(stateblock), use_vs(stateblock));
|
||||
device->shader_backend->shader_load_constants(context, use_ps(stateblock), use_vs(stateblock));
|
||||
}
|
||||
|
||||
static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
|
|
|
@ -817,6 +817,8 @@ struct vs_compile_args {
|
|||
WORD swizzle_map; /* MAX_ATTRIBS, 16 */
|
||||
};
|
||||
|
||||
struct wined3d_context;
|
||||
|
||||
typedef struct {
|
||||
void (*shader_handle_instruction)(const struct wined3d_shader_instruction *);
|
||||
void (*shader_select)(IWineD3DDevice *iface, BOOL usePS, BOOL useVS);
|
||||
|
@ -824,7 +826,7 @@ typedef struct {
|
|||
void (*shader_deselect_depth_blt)(IWineD3DDevice *iface);
|
||||
void (*shader_update_float_vertex_constants)(IWineD3DDevice *iface, UINT start, UINT count);
|
||||
void (*shader_update_float_pixel_constants)(IWineD3DDevice *iface, UINT start, UINT count);
|
||||
void (*shader_load_constants)(IWineD3DDevice *iface, char usePS, char useVS);
|
||||
void (*shader_load_constants)(const struct wined3d_context *context, char usePS, char useVS);
|
||||
void (*shader_load_np2fixup_constants)(IWineD3DDevice *iface, char usePS, char useVS);
|
||||
void (*shader_destroy)(IWineD3DBaseShader *iface);
|
||||
HRESULT (*shader_alloc_private)(IWineD3DDevice *iface);
|
||||
|
|
Loading…
Reference in New Issue