wined3d: Get rid of the posFixup field from the device.
This commit is contained in:
parent
ccd4479ce9
commit
1b2f9d29d7
|
@ -590,29 +590,29 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl)
|
|||
}
|
||||
|
||||
/* GL locking is done by the caller. */
|
||||
static inline void shader_arb_vs_local_constants(IWineD3DDeviceImpl* deviceImpl)
|
||||
static void shader_arb_vs_local_constants(const struct wined3d_context *context, IWineD3DDeviceImpl *deviceImpl)
|
||||
{
|
||||
IWineD3DStateBlockImpl* stateBlock;
|
||||
const struct wined3d_gl_info *gl_info = &deviceImpl->adapter->gl_info;
|
||||
const struct wined3d_state *state = &deviceImpl->stateBlock->state;
|
||||
unsigned char i;
|
||||
struct shader_arb_priv *priv = deviceImpl->shader_priv;
|
||||
const struct arb_vs_compiled_shader *gl_shader = priv->compiled_vprog;
|
||||
float position_fixup[4];
|
||||
|
||||
/* Upload the position fixup */
|
||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->pos_fixup, deviceImpl->posFixup));
|
||||
shader_get_position_fixup(context, state, position_fixup);
|
||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->pos_fixup, position_fixup));
|
||||
|
||||
if (!gl_shader->num_int_consts) return;
|
||||
|
||||
stateBlock = deviceImpl->stateBlock;
|
||||
|
||||
for(i = 0; i < MAX_CONST_I; i++)
|
||||
{
|
||||
if(gl_shader->int_consts[i] != WINED3D_CONST_NUM_UNUSED)
|
||||
{
|
||||
float val[4];
|
||||
val[0] = (float)stateBlock->state.vs_consts_i[4 * i];
|
||||
val[1] = (float)stateBlock->state.vs_consts_i[4 * i + 1];
|
||||
val[2] = (float)stateBlock->state.vs_consts_i[4 * i + 2];
|
||||
val[0] = (float)state->vs_consts_i[4 * i];
|
||||
val[1] = (float)state->vs_consts_i[4 * i + 1];
|
||||
val[2] = (float)state->vs_consts_i[4 * i + 2];
|
||||
val[3] = -1.0f;
|
||||
|
||||
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->int_consts[i], val));
|
||||
|
@ -641,7 +641,7 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha
|
|||
/* Load DirectX 9 float constants for vertex shader */
|
||||
device->highest_dirty_vs_const = shader_arb_load_constantsF(vshader, gl_info, GL_VERTEX_PROGRAM_ARB,
|
||||
device->highest_dirty_vs_const, stateBlock->state.vs_consts_f, context->vshader_const_dirty);
|
||||
shader_arb_vs_local_constants(device);
|
||||
shader_arb_vs_local_constants(context, device);
|
||||
}
|
||||
|
||||
if (usePixelShader)
|
||||
|
@ -4601,7 +4601,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS,
|
|||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
checkGLcall("glEnable(GL_VERTEX_PROGRAM_ARB);");
|
||||
TRACE("(%p) : Bound vertex program %u and enabled GL_VERTEX_PROGRAM_ARB\n", This, priv->current_vprogram_id);
|
||||
shader_arb_vs_local_constants(This);
|
||||
shader_arb_vs_local_constants(context, This);
|
||||
|
||||
if(priv->last_vs_color_unclamp != compiled->need_color_unclamp) {
|
||||
priv->last_vs_color_unclamp = compiled->need_color_unclamp;
|
||||
|
|
|
@ -6827,7 +6827,6 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
|
|||
list_init(&device->shaders);
|
||||
|
||||
device->surface_alignment = wined3d->dxVersion == 7 ? DDRAW_PITCH_ALIGNMENT : D3D8_PITCH_ALIGNMENT;
|
||||
device->posFixup[0] = 1.0f; /* This is needed to get the x coord unmodified through a MAD. */
|
||||
|
||||
/* Get the initial screen setup for ddraw. */
|
||||
hr = IWineD3D_GetAdapterDisplayMode((IWineD3D *)wined3d, adapter_idx, &mode);
|
||||
|
|
|
@ -733,6 +733,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
|
|||
IWineD3DDeviceImpl *device = context->swapchain->device;
|
||||
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
|
||||
struct shader_glsl_priv *priv = device->shader_priv;
|
||||
float position_fixup[4];
|
||||
|
||||
GLhandleARB programId;
|
||||
struct glsl_shader_prog_link *prog = priv->glsl_program;
|
||||
|
@ -763,7 +764,8 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
|
|||
stateBlock->changed.vertexShaderConstantsB & vshader->baseShader.reg_maps.boolean_constants);
|
||||
|
||||
/* Upload the position fixup params */
|
||||
GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, &device->posFixup[0]));
|
||||
shader_get_position_fixup(context, &stateBlock->state, position_fixup);
|
||||
GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, position_fixup));
|
||||
checkGLcall("glUniform4fvARB");
|
||||
}
|
||||
|
||||
|
|
|
@ -4644,20 +4644,6 @@ static void vertexdeclaration(DWORD state_id, IWineD3DStateBlockImpl *stateblock
|
|||
context->last_was_rhw = FALSE;
|
||||
/* This turns off the Z scale trick to 'disable' viewport frustum clipping in rhw mode*/
|
||||
device->untransformed = TRUE;
|
||||
|
||||
/* Todo for sw shaders: Vertex Shader output is already transformed, so set up identity matrices
|
||||
* Not needed as long as only hw shaders are supported
|
||||
*/
|
||||
|
||||
/* This sets the shader output position correction constants.
|
||||
* TODO: Move to the viewport state
|
||||
*/
|
||||
if (useVertexShaderFunction)
|
||||
{
|
||||
GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height;
|
||||
device->posFixup[1] = context->render_offscreen ? -1.0f : 1.0f;
|
||||
device->posFixup[3] = device->posFixup[1] * yoffset;
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't have to apply the matrices when vertex shaders are used. When vshaders are turned
|
||||
|
@ -4803,19 +4789,15 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, s
|
|||
checkGLcall("glViewport");
|
||||
}
|
||||
|
||||
static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void viewport_vertexpart(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height;
|
||||
|
||||
stateblock->device->posFixup[2] = (63.0f / 64.0f) / stateblock->state.viewport.Width;
|
||||
stateblock->device->posFixup[3] = stateblock->device->posFixup[1] * yoffset;
|
||||
|
||||
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
|
||||
transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
||||
}
|
||||
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_POINTSCALEENABLE))) {
|
||||
state_pscale(STATE_RENDER(WINED3DRS_POINTSCALEENABLE), stateblock, context);
|
||||
}
|
||||
/* Update the position fixup. */
|
||||
if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT))
|
||||
shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
|
||||
}
|
||||
|
|
|
@ -1722,9 +1722,6 @@ struct IWineD3DDeviceImpl
|
|||
DWORD ddraw_width, ddraw_height;
|
||||
enum wined3d_format_id ddraw_format;
|
||||
|
||||
/* Final position fixup constant */
|
||||
float posFixup[4];
|
||||
|
||||
/* With register combiners we can skip junk texture stages */
|
||||
DWORD texUnitMap[MAX_COMBINED_SAMPLERS];
|
||||
DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS];
|
||||
|
@ -2841,6 +2838,21 @@ static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void shader_get_position_fixup(const struct wined3d_context *context,
|
||||
const struct wined3d_state *state, float *position_fixup)
|
||||
{
|
||||
position_fixup[0] = 1.0f;
|
||||
position_fixup[1] = 1.0f;
|
||||
position_fixup[2] = (63.0f / 64.0f) / state->viewport.Width;
|
||||
position_fixup[3] = -(63.0f / 64.0f) / state->viewport.Height;
|
||||
|
||||
if (context->render_offscreen)
|
||||
{
|
||||
position_fixup[1] *= -1.0f;
|
||||
position_fixup[3] *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static inline BOOL shader_constant_is_local(IWineD3DBaseShaderImpl* This, DWORD reg) {
|
||||
local_constant* lconst;
|
||||
|
||||
|
|
Loading…
Reference in New Issue