wined3d: Pass a wined3d_state structure to use_ps().
This commit is contained in:
parent
9224751a13
commit
a7ded9a67d
|
@ -4457,7 +4457,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
|
|||
find_vs_compile_args(shader, stateblock, &args->super);
|
||||
|
||||
args->clip.boolclip_compare = 0;
|
||||
if(use_ps(stateblock))
|
||||
if (use_ps(state))
|
||||
{
|
||||
IWineD3DPixelShaderImpl *ps = state->pixel_shader;
|
||||
struct arb_pshader_private *shader_priv = ps->baseShader.backend_data;
|
||||
|
@ -5533,45 +5533,50 @@ static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
|
|||
caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8);
|
||||
}
|
||||
|
||||
static void state_texfactor_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void state_texfactor_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
float col[4];
|
||||
|
||||
/* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite
|
||||
* application provided constants
|
||||
*/
|
||||
if(device->shader_backend == &arb_program_shader_backend) {
|
||||
if (use_ps(stateblock)) return;
|
||||
if (device->shader_backend == &arb_program_shader_backend)
|
||||
{
|
||||
if (use_ps(state)) return;
|
||||
|
||||
context->pshader_const_dirty[ARB_FFP_CONST_TFACTOR] = 1;
|
||||
device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, ARB_FFP_CONST_TFACTOR + 1);
|
||||
}
|
||||
|
||||
D3DCOLORTOGLFLOAT4(stateblock->state.render_states[WINED3DRS_TEXTUREFACTOR], col);
|
||||
D3DCOLORTOGLFLOAT4(state->render_states[WINED3DRS_TEXTUREFACTOR], col);
|
||||
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_TFACTOR, col));
|
||||
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_TFACTOR, col)");
|
||||
|
||||
}
|
||||
|
||||
static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void state_arb_specularenable(DWORD state_id,
|
||||
IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
float col[4];
|
||||
|
||||
/* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite
|
||||
* application provided constants
|
||||
*/
|
||||
if(device->shader_backend == &arb_program_shader_backend) {
|
||||
if (use_ps(stateblock)) return;
|
||||
if (device->shader_backend == &arb_program_shader_backend)
|
||||
{
|
||||
if (use_ps(state)) return;
|
||||
|
||||
context->pshader_const_dirty[ARB_FFP_CONST_SPECULAR_ENABLE] = 1;
|
||||
device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, ARB_FFP_CONST_SPECULAR_ENABLE + 1);
|
||||
}
|
||||
|
||||
if (stateblock->state.render_states[WINED3DRS_SPECULARENABLE])
|
||||
if (state->render_states[WINED3DRS_SPECULARENABLE])
|
||||
{
|
||||
/* The specular color has no alpha */
|
||||
col[0] = 1.0f; col[1] = 1.0f;
|
||||
|
@ -5584,16 +5589,17 @@ static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateb
|
|||
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col)");
|
||||
}
|
||||
|
||||
static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void set_bumpmat_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
float mat[2][2];
|
||||
|
||||
if (use_ps(stateblock))
|
||||
if (use_ps(state))
|
||||
{
|
||||
IWineD3DPixelShaderImpl *ps = stateblock->state.pixel_shader;
|
||||
IWineD3DPixelShaderImpl *ps = state->pixel_shader;
|
||||
if (stage && (ps->baseShader.reg_maps.bumpmat & (1 << stage)))
|
||||
{
|
||||
/* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled
|
||||
|
@ -5612,25 +5618,26 @@ static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, s
|
|||
device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, ARB_FFP_CONST_BUMPMAT(stage) + 1);
|
||||
}
|
||||
|
||||
mat[0][0] = *((float *)&stateblock->state.texture_states[stage][WINED3DTSS_BUMPENVMAT00]);
|
||||
mat[0][1] = *((float *)&stateblock->state.texture_states[stage][WINED3DTSS_BUMPENVMAT01]);
|
||||
mat[1][0] = *((float *)&stateblock->state.texture_states[stage][WINED3DTSS_BUMPENVMAT10]);
|
||||
mat[1][1] = *((float *)&stateblock->state.texture_states[stage][WINED3DTSS_BUMPENVMAT11]);
|
||||
mat[0][0] = *((float *)&state->texture_states[stage][WINED3DTSS_BUMPENVMAT00]);
|
||||
mat[0][1] = *((float *)&state->texture_states[stage][WINED3DTSS_BUMPENVMAT01]);
|
||||
mat[1][0] = *((float *)&state->texture_states[stage][WINED3DTSS_BUMPENVMAT10]);
|
||||
mat[1][1] = *((float *)&state->texture_states[stage][WINED3DTSS_BUMPENVMAT11]);
|
||||
|
||||
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_BUMPMAT(stage), &mat[0][0]));
|
||||
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_BUMPMAT(stage), &mat[0][0])");
|
||||
}
|
||||
|
||||
static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void tex_bumpenvlum_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
float param[4];
|
||||
|
||||
if (use_ps(stateblock))
|
||||
if (use_ps(state))
|
||||
{
|
||||
IWineD3DPixelShaderImpl *ps = stateblock->state.pixel_shader;
|
||||
IWineD3DPixelShaderImpl *ps = state->pixel_shader;
|
||||
if (stage && (ps->baseShader.reg_maps.luminanceparams & (1 << stage)))
|
||||
{
|
||||
/* The pixel shader has to know the luminance offset. Do a constants update if it
|
||||
|
@ -5649,8 +5656,8 @@ static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock
|
|||
device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, ARB_FFP_CONST_LUMINANCE(stage) + 1);
|
||||
}
|
||||
|
||||
param[0] = *((float *)&stateblock->state.texture_states[stage][WINED3DTSS_BUMPENVLSCALE]);
|
||||
param[1] = *((float *)&stateblock->state.texture_states[stage][WINED3DTSS_BUMPENVLOFFSET]);
|
||||
param[0] = *((float *)&state->texture_states[stage][WINED3DTSS_BUMPENVLSCALE]);
|
||||
param[1] = *((float *)&state->texture_states[stage][WINED3DTSS_BUMPENVLOFFSET]);
|
||||
param[2] = 0.0f;
|
||||
param[3] = 0.0f;
|
||||
|
||||
|
@ -6149,18 +6156,19 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void fragment_prog_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
struct shader_arb_priv *priv = device->fragment_priv;
|
||||
BOOL use_vshader = use_vs(&stateblock->state);
|
||||
BOOL use_pshader = use_ps(stateblock);
|
||||
BOOL use_vshader = use_vs(state);
|
||||
BOOL use_pshader = use_ps(state);
|
||||
struct ffp_frag_settings settings;
|
||||
const struct arbfp_ffp_desc *desc;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
|
||||
TRACE("state_id %#x, stateblock %p, context %p\n", state_id, stateblock, context);
|
||||
|
||||
if(isStateDirty(context, STATE_RENDER(WINED3DRS_FOGENABLE))) {
|
||||
if(!use_pshader && device->shader_backend == &arb_program_shader_backend && context->last_was_pshader) {
|
||||
|
|
|
@ -893,7 +893,7 @@ static void atifs_apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stat
|
|||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
BOOL use_vshader = use_vs(state);
|
||||
|
||||
context->last_was_pshader = use_ps(stateblock);
|
||||
context->last_was_pshader = use_ps(state);
|
||||
/* The ATIFS code does not support pixel shaders currently, but we have to provide a state handler
|
||||
* to call shader_select to select a vertex shader if one is applied because the vertex shader state
|
||||
* may defer calling the shader backend if the pshader state is dirty.
|
||||
|
|
|
@ -478,7 +478,7 @@ void device_preload_textures(IWineD3DDeviceImpl *device)
|
|||
}
|
||||
}
|
||||
|
||||
if (use_ps(stateblock))
|
||||
if (use_ps(state))
|
||||
{
|
||||
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
|
||||
{
|
||||
|
@ -3586,8 +3586,9 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps, const struct
|
|||
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
|
||||
BOOL vs = use_vs(&This->stateBlock->state);
|
||||
BOOL ps = use_ps(This->stateBlock);
|
||||
const struct wined3d_state *state = &This->stateBlock->state;
|
||||
BOOL vs = use_vs(state);
|
||||
BOOL ps = use_ps(state);
|
||||
/*
|
||||
* Rules are:
|
||||
* -> Pixel shaders need a 1:1 map. In theory the shader input could be mapped too, but
|
||||
|
|
|
@ -69,9 +69,10 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
const DWORD *pIdxBufL = NULL;
|
||||
UINT vx_index;
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
const struct wined3d_stream_state *streams = This->stateBlock->state.streams;
|
||||
LONG SkipnStrides = startIdx + This->stateBlock->state.load_base_vertex_index;
|
||||
BOOL pixelShader = use_ps(This->stateBlock);
|
||||
const struct wined3d_state *state = &This->stateBlock->state;
|
||||
const struct wined3d_stream_state *streams = state->streams;
|
||||
LONG SkipnStrides = startIdx + state->load_base_vertex_index;
|
||||
BOOL pixelShader = use_ps(state);
|
||||
BOOL specular_fog = FALSE;
|
||||
const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
|
||||
const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
|
||||
|
@ -91,7 +92,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
* supported or other reason), or with user pointer drawing idxData
|
||||
* will be non-NULL. */
|
||||
if (!idxData)
|
||||
idxData = buffer_get_sysmem(This->stateBlock->state.index_buffer, gl_info);
|
||||
idxData = buffer_get_sysmem(state->index_buffer, gl_info);
|
||||
|
||||
if (idxSize == 2) pIdxBufS = idxData;
|
||||
else pIdxBufL = idxData;
|
||||
|
@ -139,10 +140,10 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
specular = element->data + streams[element->stream_idx].offset;
|
||||
|
||||
/* special case where the fog density is stored in the specular alpha channel */
|
||||
if (This->stateBlock->state.render_states[WINED3DRS_FOGENABLE]
|
||||
&& (This->stateBlock->state.render_states[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE
|
||||
if (state->render_states[WINED3DRS_FOGENABLE]
|
||||
&& (state->render_states[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE
|
||||
|| si->elements[WINED3D_FFP_POSITION].format->id == WINED3DFMT_R32G32B32A32_FLOAT)
|
||||
&& This->stateBlock->state.render_states[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
|
||||
&& state->render_states[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
|
||||
{
|
||||
if (gl_info->supported[EXT_FOG_COORD])
|
||||
{
|
||||
|
@ -169,7 +170,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
|
||||
for (textureNo = 0; textureNo < texture_stages; ++textureNo)
|
||||
{
|
||||
int coordIdx = This->stateBlock->state.texture_states[textureNo][WINED3DTSS_TEXCOORDINDEX];
|
||||
int coordIdx = state->texture_states[textureNo][WINED3DTSS_TEXCOORDINDEX];
|
||||
DWORD texture_idx = This->texUnitMap[textureNo];
|
||||
|
||||
if (!gl_info->supported[ARB_MULTITEXTURE] && textureNo > 0)
|
||||
|
@ -178,7 +179,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!pixelShader && !This->stateBlock->state.textures[textureNo]) continue;
|
||||
if (!pixelShader && !state->textures[textureNo]) continue;
|
||||
|
||||
if (texture_idx == WINED3D_UNMAPPED_STAGE) continue;
|
||||
|
||||
|
@ -225,9 +226,9 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
{
|
||||
/* Indexed so work out the number of strides to skip */
|
||||
if (idxSize == 2)
|
||||
SkipnStrides = pIdxBufS[startIdx + vx_index] + This->stateBlock->state.load_base_vertex_index;
|
||||
SkipnStrides = pIdxBufS[startIdx + vx_index] + state->load_base_vertex_index;
|
||||
else
|
||||
SkipnStrides = pIdxBufL[startIdx + vx_index] + This->stateBlock->state.load_base_vertex_index;
|
||||
SkipnStrides = pIdxBufL[startIdx + vx_index] + state->load_base_vertex_index;
|
||||
}
|
||||
|
||||
tmp_tex_mask = tex_mask;
|
||||
|
@ -239,7 +240,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|
|||
|
||||
if (!(tmp_tex_mask & 1)) continue;
|
||||
|
||||
coord_idx = This->stateBlock->state.texture_states[texture][WINED3DTSS_TEXCOORDINDEX];
|
||||
coord_idx = state->texture_states[texture][WINED3DTSS_TEXCOORDINDEX];
|
||||
ptr = texCoords[coord_idx] + (SkipnStrides * si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].stride);
|
||||
|
||||
texture_idx = This->texUnitMap[texture];
|
||||
|
|
|
@ -456,17 +456,18 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
|
|||
}
|
||||
|
||||
|
||||
static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void nvrc_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
|
||||
DWORD mapped_stage = stateblock->device->texUnitMap[stage];
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
|
||||
TRACE("Setting color op for stage %d\n", stage);
|
||||
TRACE("Setting color op for stage %u.\n", stage);
|
||||
|
||||
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
|
||||
if (use_ps(stateblock)) return;
|
||||
if (use_ps(state)) return;
|
||||
|
||||
if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
|
||||
|
||||
|
|
|
@ -1681,17 +1681,18 @@ static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock,
|
|||
}
|
||||
}
|
||||
|
||||
static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void state_pointsprite(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
|
||||
if (stateblock->state.render_states[WINED3DRS_POINTSPRITEENABLE])
|
||||
if (state->render_states[WINED3DRS_POINTSPRITEENABLE])
|
||||
{
|
||||
static BOOL warned;
|
||||
|
||||
if (gl_info->limits.point_sprite_units < gl_info->limits.textures && !warned)
|
||||
{
|
||||
if (use_ps(stateblock) || stateblock->state.lowest_disabled_stage > gl_info->limits.point_sprite_units)
|
||||
if (use_ps(state) || state->lowest_disabled_stage > gl_info->limits.point_sprite_units)
|
||||
{
|
||||
FIXME("The app uses point sprite texture coordinates on more units than supported by the driver\n");
|
||||
warned = TRUE;
|
||||
|
@ -3099,17 +3100,18 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
|
|||
}
|
||||
|
||||
|
||||
static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void tex_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
||||
BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
|
||||
DWORD mapped_stage = stateblock->device->texUnitMap[stage];
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
|
||||
TRACE("Setting color op for stage %d\n", stage);
|
||||
|
||||
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
|
||||
if (use_ps(stateblock)) return;
|
||||
if (use_ps(state)) return;
|
||||
|
||||
if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
|
||||
|
||||
|
@ -3124,7 +3126,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||
checkGLcall("glActiveTextureARB");
|
||||
}
|
||||
|
||||
if (stage >= stateblock->state.lowest_disabled_stage)
|
||||
if (stage >= state->lowest_disabled_stage)
|
||||
{
|
||||
TRACE("Stage disabled\n");
|
||||
if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
||||
|
@ -3152,13 +3154,13 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
|
|||
/* The sampler will also activate the correct texture dimensions, so no
|
||||
* need to do it here if the sampler for this stage is dirty. */
|
||||
if (!isStateDirty(context, STATE_SAMPLER(stage)) && tex_used)
|
||||
texture_activate_dimensions(stateblock->state.textures[stage], gl_info);
|
||||
texture_activate_dimensions(state->textures[stage], gl_info);
|
||||
|
||||
set_tex_op(gl_info, &stateblock->state, FALSE, stage,
|
||||
stateblock->state.texture_states[stage][WINED3DTSS_COLOROP],
|
||||
stateblock->state.texture_states[stage][WINED3DTSS_COLORARG1],
|
||||
stateblock->state.texture_states[stage][WINED3DTSS_COLORARG2],
|
||||
stateblock->state.texture_states[stage][WINED3DTSS_COLORARG0]);
|
||||
set_tex_op(gl_info, state, FALSE, stage,
|
||||
state->texture_states[stage][WINED3DTSS_COLOROP],
|
||||
state->texture_states[stage][WINED3DTSS_COLORARG1],
|
||||
state->texture_states[stage][WINED3DTSS_COLORARG2],
|
||||
state->texture_states[stage][WINED3DTSS_COLORARG0]);
|
||||
}
|
||||
|
||||
void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
|
@ -3302,7 +3304,8 @@ static void transform_texture(DWORD state_id, IWineD3DStateBlockImpl *stateblock
|
|||
}
|
||||
/* NP2 texcoord fixup is implemented for pixelshaders so only enable the
|
||||
fixed-function-pipeline fixup via pow2Matrix when no PS is used. */
|
||||
if (!use_ps(stateblock)) {
|
||||
if (!use_ps(state))
|
||||
{
|
||||
TRACE("Non power two matrix multiply fixup\n");
|
||||
glMultMatrixf(state->textures[texUnit]->baseTexture.pow2Matrix);
|
||||
}
|
||||
|
@ -3547,8 +3550,9 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
|
|||
}
|
||||
}
|
||||
|
||||
static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void shaderconstant(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
|
||||
/* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
|
||||
|
@ -3559,7 +3563,7 @@ static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
|
|||
return;
|
||||
}
|
||||
|
||||
device->shader_backend->shader_load_constants(context, use_ps(stateblock), use_vs(&stateblock->state));
|
||||
device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state));
|
||||
}
|
||||
|
||||
static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
|
@ -3655,7 +3659,7 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
|
|||
checkGLcall("glTexEnvi(GL_TEXTURE_LOD_BIAS_EXT, ...)");
|
||||
}
|
||||
|
||||
if (!use_ps(stateblock) && sampler < state->lowest_disabled_stage)
|
||||
if (!use_ps(state) && sampler < state->lowest_disabled_stage)
|
||||
{
|
||||
if (state->render_states[WINED3DRS_COLORKEYENABLE] && !sampler)
|
||||
{
|
||||
|
@ -3671,7 +3675,7 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
|
|||
{
|
||||
IWineD3DDeviceImpl *d3ddevice = stateblock->device;
|
||||
d3ddevice->shader_backend->shader_load_np2fixup_constants(
|
||||
(IWineD3DDevice*)d3ddevice, use_ps(stateblock), use_vs(state));
|
||||
(IWineD3DDevice*)d3ddevice, use_ps(state), use_vs(state));
|
||||
}
|
||||
}
|
||||
else if (mapped_stage < gl_info->limits.textures)
|
||||
|
@ -3692,11 +3696,12 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
|
|||
}
|
||||
}
|
||||
|
||||
void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
void apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
BOOL use_vshader = use_vs(&stateblock->state);
|
||||
BOOL use_pshader = use_ps(stateblock);
|
||||
BOOL use_vshader = use_vs(state);
|
||||
BOOL use_pshader = use_ps(state);
|
||||
unsigned int i;
|
||||
|
||||
if (use_pshader) {
|
||||
|
@ -4610,12 +4615,13 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
|
|||
}
|
||||
}
|
||||
|
||||
static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
static void vertexdeclaration(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_state *state = &stateblock->state;
|
||||
BOOL useVertexShaderFunction = use_vs(state);
|
||||
BOOL usePixelShaderFunction = use_ps(state);
|
||||
BOOL updateFog = FALSE;
|
||||
BOOL useVertexShaderFunction = use_vs(&stateblock->state);
|
||||
BOOL usePixelShaderFunction = use_ps(stateblock);
|
||||
IWineD3DDeviceImpl *device = stateblock->device;
|
||||
BOOL transformed;
|
||||
BOOL wasrhw = context->last_was_rhw;
|
||||
|
|
|
@ -3026,9 +3026,9 @@ static inline BOOL use_vs(const struct wined3d_state *state)
|
|||
return state->vertex_shader && !state->vertex_declaration->position_transformed;
|
||||
}
|
||||
|
||||
static inline BOOL use_ps(IWineD3DStateBlockImpl *stateblock)
|
||||
static inline BOOL use_ps(const struct wined3d_state *state)
|
||||
{
|
||||
return !!stateblock->state.pixel_shader;
|
||||
return !!state->pixel_shader;
|
||||
}
|
||||
|
||||
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
|
||||
|
|
Loading…
Reference in New Issue