Commit 0cbd08b2 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Disable texture filtering on textures that do not support it.

OpenGL always offers filtering on all formats, and if the hardware doesn't support it the driver falls back to software. Direct3D on the other hand silently disables filtering, so that's what we should do too.
parent 4bb54a1a
...@@ -789,7 +789,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U ...@@ -789,7 +789,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
D3DINITIALIZEBASETEXTURE(object->baseTexture); D3DINITIALIZEBASETEXTURE(object->baseTexture);
object->width = Width; object->width = Width;
object->height = Height; object->height = Height;
if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
object->baseTexture.minMipLookup = &minMipLookup; object->baseTexture.minMipLookup = &minMipLookup;
} else {
object->baseTexture.minMipLookup = &minMipLookup_noFilter;
}
/** Non-power2 support **/ /** Non-power2 support **/
if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO)) { if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO)) {
...@@ -935,7 +940,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa ...@@ -935,7 +940,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
object->baseTexture.pow2Matrix[10] = 1.0; object->baseTexture.pow2Matrix[10] = 1.0;
object->baseTexture.pow2Matrix[15] = 1.0; object->baseTexture.pow2Matrix[15] = 1.0;
if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
object->baseTexture.minMipLookup = &minMipLookup; object->baseTexture.minMipLookup = &minMipLookup;
} else {
object->baseTexture.minMipLookup = &minMipLookup_noFilter;
}
/* Calculate levels for mip mapping */ /* Calculate levels for mip mapping */
if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) { if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
...@@ -1084,7 +1093,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface ...@@ -1084,7 +1093,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
object->baseTexture.pow2Matrix[10] = ((float)EdgeLength) / ((float)pow2EdgeLength); object->baseTexture.pow2Matrix[10] = ((float)EdgeLength) / ((float)pow2EdgeLength);
object->baseTexture.pow2Matrix[15] = 1.0; object->baseTexture.pow2Matrix[15] = 1.0;
if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
object->baseTexture.minMipLookup = &minMipLookup; object->baseTexture.minMipLookup = &minMipLookup;
} else {
object->baseTexture.minMipLookup = &minMipLookup_noFilter;
}
/* Calculate levels for mip mapping */ /* Calculate levels for mip mapping */
if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) { if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
......
...@@ -155,6 +155,12 @@ int maxLookup[MAX_LOOKUPS]; ...@@ -155,6 +155,12 @@ int maxLookup[MAX_LOOKUPS];
DWORD *stateLookup[MAX_LOOKUPS]; DWORD *stateLookup[MAX_LOOKUPS];
DWORD minMipLookup[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1]; DWORD minMipLookup[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1];
DWORD minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1] = {
{GL_NEAREST, GL_NEAREST, GL_NEAREST},
{GL_NEAREST, GL_NEAREST, GL_NEAREST},
{GL_NEAREST, GL_NEAREST, GL_NEAREST},
{GL_NEAREST, GL_NEAREST, GL_NEAREST},
};
/* drawStridedSlow attributes */ /* drawStridedSlow attributes */
glAttribFunc position_funcs[WINED3DDECLTYPE_UNUSED]; glAttribFunc position_funcs[WINED3DDECLTYPE_UNUSED];
......
...@@ -114,6 +114,7 @@ extern DWORD *stateLookup[MAX_LOOKUPS]; ...@@ -114,6 +114,7 @@ extern DWORD *stateLookup[MAX_LOOKUPS];
typedef DWORD minMipLookup_t[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1]; typedef DWORD minMipLookup_t[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1];
extern minMipLookup_t minMipLookup; extern minMipLookup_t minMipLookup;
extern minMipLookup_t minMipLookup_noFilter;
void init_type_lookup(WineD3D_GL_Info *gl_info); void init_type_lookup(WineD3D_GL_Info *gl_info);
#define WINED3D_ATR_TYPE(type) GLINFO_LOCATION.glTypeLookup[type].d3dType #define WINED3D_ATR_TYPE(type) GLINFO_LOCATION.glTypeLookup[type].d3dType
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment