[PATCH 3/7] d3d11: Ensure sampler max_lod is >= min_lod.

Henri Verbeet hverbeet at codeweavers.com
Thu Mar 11 06:54:31 CST 2021


A maximum level of detail smaller than the minimum is poorly defined in OpenGL
and D3D, and disallowed by Vulkan. Found by the Vulkan validation layers.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/d3d11/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c
index 737dae93848..6b287176536 100644
--- a/dlls/d3d11/state.c
+++ b/dlls/d3d11/state.c
@@ -1551,7 +1551,7 @@ static HRESULT d3d_sampler_state_init(struct d3d_sampler_state *state, struct d3
     wined3d_desc.mip_filter = wined3d_texture_filter_mip_from_d3d11(desc->Filter);
     wined3d_desc.lod_bias = desc->MipLODBias;
     wined3d_desc.min_lod = desc->MinLOD;
-    wined3d_desc.max_lod = desc->MaxLOD;
+    wined3d_desc.max_lod = max(desc->MinLOD, desc->MaxLOD);
     wined3d_desc.mip_base_level = 0;
     wined3d_desc.max_anisotropy = D3D11_DECODE_IS_ANISOTROPIC_FILTER(desc->Filter) ? desc->MaxAnisotropy : 1;
     wined3d_desc.compare = wined3d_texture_compare_from_d3d11(desc->Filter);
-- 
2.20.1




More information about the wine-devel mailing list