Skip to content

Commit 1a1cd8c

Browse files
committed
Fixed bug 1878 - Scaled texture draws with filtering produce wrapping artifacts.
Yuri K. Schlesner When using texture filtering, there are filtering artifacts visible on the edges of scaled textures, where the texture filtering pulls in texels from the other side of the texture. Using clamping texture modes wouldn't completely fix this since source rectangles don't need to cover the whole texture. (See screenshot attached in next post.) The opengl driver uses clamping on textures and so avoid this at least in the cases where the source rect is the whole texture. The direct3d driver does not and so has problems in every case. I'm not sure if it can actually completely be fixed, but at least enabling clamping for direct3d would be one step in the right direction.
1 parent 7472963 commit 1a1cd8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/render/direct3d/SDL_render_d3d.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,10 @@ D3D_UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *texturedata, u
14121412
texturedata->scaleMode);
14131413
IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_MAGFILTER,
14141414
texturedata->scaleMode);
1415+
IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSU,
1416+
D3DTADDRESS_CLAMP);
1417+
IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSV,
1418+
D3DTADDRESS_CLAMP);
14151419
data->scaleMode[index] = texturedata->scaleMode;
14161420
}
14171421
}

0 commit comments

Comments
 (0)