wined3d: Move fixed function texture dimension updates to the fragment pipeline.

This is a further separation of the sampler state, and a preparation
to move the nv texture shader stuff to its own pipeline implementation.
This commit is contained in:
Stefan Dösinger 2008-07-04 12:06:58 -05:00 committed by Alexandre Julliard
parent d3c29b7063
commit 51e64b3fe9
4 changed files with 33 additions and 8 deletions

View File

@ -958,6 +958,14 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), set_bumpmat }},
{STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), set_bumpmat }},
{STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), set_bumpmat }},
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }},
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }},
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }},
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }},
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }},
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }},
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }},
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }},
{0 /* Terminate */, { 0, 0 }},
};

View File

@ -2430,10 +2430,6 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
glEnable(stateblock->textureDimensions[sampler]);
checkGLcall("glEnable(stateblock->textureDimensions[sampler])");
} else if(sampler < stateblock->lowest_disabled_stage) {
if(!isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) {
texture_activate_dimensions(sampler, stateblock, context);
}
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
/* If color keying is enabled update the alpha test, it depends on the existence
* of a color key in stage 0
@ -2444,10 +2440,6 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
} else if(mapped_stage < GL_LIMITS(textures)) {
if(sampler < stateblock->lowest_disabled_stage) {
/* TODO: What should I do with pixel shaders here ??? */
if(!isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) {
texture_activate_dimensions(sampler, stateblock, context);
}
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
/* If color keying is enabled update the alpha test, it depends on the existence
* of a color key in stage 0
@ -4460,6 +4452,14 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
{ STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), { STATE_PIXELSHADER, pixelshader }},
{ STATE_RENDER(WINED3DRS_BORDERCOLOR), { STATE_RENDER(WINED3DRS_BORDERCOLOR), state_bordercolor }},
{ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor }},
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }},
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }},
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }},
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }},
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }},
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }},
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }},
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }},
{0 /* Terminate */, { 0, 0 }},
};
#undef GLINFO_LOCATION

View File

@ -3498,4 +3498,20 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
}
}
}
void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
/* No need to enable / disable anything here for unused samplers. The tex_colorop
* handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
* will take care of this business
*/
if(mapped_stage == -1 || mapped_stage >= GL_LIMITS(textures)) return;
if(sampler >= stateblock->lowest_disabled_stage) return;
if(use_ps(stateblock->wineD3DDevice)) return;
if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
texture_activate_dimensions(sampler, stateblock, context);
}
#undef GLINFO_LOCATION

View File

@ -1733,6 +1733,7 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTURE
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst);
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, DWORD coordtype);
void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height);
GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain);