wined3d: Add functions to lookup texture filters.
This commit is contained in:
parent
0f161dc10f
commit
351d6de818
|
@ -377,8 +377,10 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
|
|||
state = samplerStates[WINED3DSAMP_MAGFILTER];
|
||||
if (state > WINED3DTEXF_ANISOTROPIC) {
|
||||
FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state);
|
||||
} else {
|
||||
glValue = This->baseTexture.magLookup[state - WINED3DTEXF_NONE];
|
||||
}
|
||||
else
|
||||
{
|
||||
glValue = wined3d_gl_mag_filter(This->baseTexture.magLookup, state);
|
||||
TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue);
|
||||
}
|
||||
|
@ -402,9 +404,9 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
|
|||
states[WINED3DTEXSTA_MINFILTER],
|
||||
states[WINED3DTEXSTA_MIPFILTER]);
|
||||
}
|
||||
glValue = This->baseTexture.minMipLookup
|
||||
[min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
|
||||
.mip[min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
|
||||
glValue = wined3d_gl_min_mip_filter(This->baseTexture.minMipLookup,
|
||||
min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC),
|
||||
min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR));
|
||||
|
||||
TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
|
||||
samplerStates[WINED3DSAMP_MINFILTER],
|
||||
|
|
|
@ -3182,10 +3182,10 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
|
|||
|
||||
/* No issue with overriding these - the sampler is dirty due to blit usage */
|
||||
glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER,
|
||||
magLookup[Filter - WINED3DTEXF_NONE]);
|
||||
wined3d_gl_mag_filter(magLookup, Filter));
|
||||
checkGLcall("glTexParameteri");
|
||||
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER,
|
||||
minMipLookup[Filter].mip[WINED3DTEXF_NONE]);
|
||||
wined3d_gl_min_mip_filter(minMipLookup, Filter, WINED3DTEXF_NONE));
|
||||
checkGLcall("glTexParameteri");
|
||||
|
||||
if(!swapchain || (IWineD3DSurface *) Src == swapchain->backBuffer[0]) {
|
||||
|
@ -3744,9 +3744,11 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
|
|||
checkGLcall("glBindTexture");
|
||||
|
||||
/* Filtering for StretchRect */
|
||||
glTexParameteri(Src->texture_target, GL_TEXTURE_MAG_FILTER, magLookup[Filter - WINED3DTEXF_NONE]);
|
||||
glTexParameteri(Src->texture_target, GL_TEXTURE_MAG_FILTER,
|
||||
wined3d_gl_mag_filter(magLookup, Filter));
|
||||
checkGLcall("glTexParameteri");
|
||||
glTexParameteri(Src->texture_target, GL_TEXTURE_MIN_FILTER, minMipLookup[Filter].mip[WINED3DTEXF_NONE]);
|
||||
glTexParameteri(Src->texture_target, GL_TEXTURE_MIN_FILTER,
|
||||
wined3d_gl_min_mip_filter(minMipLookup, Filter, WINED3DTEXF_NONE));
|
||||
checkGLcall("glTexParameteri");
|
||||
glTexParameteri(Src->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(Src->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
|
|
|
@ -181,6 +181,17 @@ const struct min_lookup minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1];
|
|||
const GLenum magLookup[WINED3DTEXF_ANISOTROPIC + 1];
|
||||
const GLenum magLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1];
|
||||
|
||||
static inline GLenum wined3d_gl_mag_filter(const GLenum mag_lookup[], WINED3DTEXTUREFILTERTYPE mag_filter)
|
||||
{
|
||||
return mag_lookup[mag_filter];
|
||||
}
|
||||
|
||||
static inline GLenum wined3d_gl_min_mip_filter(const struct min_lookup min_mip_lookup[],
|
||||
WINED3DTEXTUREFILTERTYPE min_filter, WINED3DTEXTUREFILTERTYPE mip_filter)
|
||||
{
|
||||
return min_mip_lookup[min_filter].mip[mip_filter];
|
||||
}
|
||||
|
||||
/* float_16_to_32() and float_32_to_16() (see implementation in
|
||||
* surface_base.c) convert 16 bit floats in the FLOAT16 data type
|
||||
* to standard C floats and vice versa. They do not depend on the encoding
|
||||
|
|
Loading…
Reference in New Issue