diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index 56ba56067bb..02fa1dc4ef3 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -336,13 +336,13 @@ struct d3d_sampler_state struct wined3d_private_store private_store; struct wined3d_sampler *wined3d_sampler; - D3D10_SAMPLER_DESC desc; + D3D11_SAMPLER_DESC desc; struct wine_rb_entry entry; ID3D11Device *device; }; HRESULT d3d_sampler_state_init(struct d3d_sampler_state *state, struct d3d_device *device, - const D3D10_SAMPLER_DESC *desc) DECLSPEC_HIDDEN; + const D3D11_SAMPLER_DESC *desc) DECLSPEC_HIDDEN; struct d3d_sampler_state *unsafe_impl_from_ID3D10SamplerState(ID3D10SamplerState *iface) DECLSPEC_HIDDEN; /* ID3D10Query */ diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 4358fb3adab..f649d6bcc9c 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -3567,7 +3567,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device1 * if (!object) return E_OUTOFMEMORY; - if (FAILED(hr = d3d_sampler_state_init(object, device, desc))) + if (FAILED(hr = d3d_sampler_state_init(object, device, (const D3D11_SAMPLER_DESC *)desc))) { WARN("Failed to initialize sampler state, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); @@ -4112,8 +4112,8 @@ static void d3d_rb_free(void *ptr) static int d3d_sampler_state_compare(const void *key, const struct wine_rb_entry *entry) { - const D3D10_SAMPLER_DESC *ka = key; - const D3D10_SAMPLER_DESC *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d_sampler_state, entry)->desc; + const D3D11_SAMPLER_DESC *ka = key; + const D3D11_SAMPLER_DESC *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d_sampler_state, entry)->desc; return memcmp(ka, kb, sizeof(*ka)); } diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index f98949580ca..2151389d7d0 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -24,12 +24,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d11); -#define D3D10_FILTER_MIP_MASK 0x01 -#define D3D10_FILTER_MAG_MASK 0x04 -#define D3D10_FILTER_MIN_MASK 0x10 -#define D3D10_FILTER_ANISO_MASK 0x40 -#define D3D10_FILTER_COMPARE_MASK 0x80 - /* ID3D11BlendState methods */ static inline struct d3d_blend_state *impl_from_ID3D11BlendState(ID3D11BlendState *iface) @@ -981,7 +975,11 @@ static HRESULT STDMETHODCALLTYPE d3d11_sampler_state_SetPrivateDataInterface(ID3 static void STDMETHODCALLTYPE d3d11_sampler_state_GetDesc(ID3D11SamplerState *iface, D3D11_SAMPLER_DESC *desc) { - FIXME("iface %p, desc %p stub!\n", iface, desc); + struct d3d_sampler_state *state = impl_from_ID3D11SamplerState(iface); + + TRACE("iface %p, desc %p.\n", iface, desc); + + *desc = state->desc; } static const struct ID3D11SamplerStateVtbl d3d11_sampler_state_vtbl = @@ -1088,7 +1086,7 @@ static void STDMETHODCALLTYPE d3d10_sampler_state_GetDesc(ID3D10SamplerState *if TRACE("iface %p, desc %p.\n", iface, desc); - *desc = state->desc; + memcpy(desc, &state->desc, sizeof(*desc)); } static const struct ID3D10SamplerStateVtbl d3d10_sampler_state_vtbl = @@ -1106,44 +1104,44 @@ static const struct ID3D10SamplerStateVtbl d3d10_sampler_state_vtbl = d3d10_sampler_state_GetDesc, }; -static enum wined3d_texture_address wined3d_texture_address_from_d3d10core(enum D3D10_TEXTURE_ADDRESS_MODE t) +static enum wined3d_texture_address wined3d_texture_address_from_d3d11(enum D3D11_TEXTURE_ADDRESS_MODE t) { return (enum wined3d_texture_address)t; } -static enum wined3d_texture_filter_type wined3d_texture_filter_mip_from_d3d10core(enum D3D10_FILTER f) +static enum wined3d_texture_filter_type wined3d_texture_filter_mip_from_d3d11(enum D3D11_FILTER f) { - if (f & D3D10_FILTER_MIP_MASK) + if (D3D11_DECODE_MIP_FILTER(f) == D3D11_FILTER_TYPE_LINEAR) return WINED3D_TEXF_LINEAR; return WINED3D_TEXF_POINT; } -static enum wined3d_texture_filter_type wined3d_texture_filter_mag_from_d3d10core(enum D3D10_FILTER f) +static enum wined3d_texture_filter_type wined3d_texture_filter_mag_from_d3d11(enum D3D11_FILTER f) { - if (f & D3D10_FILTER_MAG_MASK) + if (D3D11_DECODE_MAG_FILTER(f) == D3D11_FILTER_TYPE_LINEAR) return WINED3D_TEXF_LINEAR; return WINED3D_TEXF_POINT; } -static enum wined3d_texture_filter_type wined3d_texture_filter_min_from_d3d10core(enum D3D10_FILTER f) +static enum wined3d_texture_filter_type wined3d_texture_filter_min_from_d3d11(enum D3D11_FILTER f) { - if (f & D3D10_FILTER_MIN_MASK) + if (D3D11_DECODE_MIN_FILTER(f) == D3D11_FILTER_TYPE_LINEAR) return WINED3D_TEXF_LINEAR; return WINED3D_TEXF_POINT; } -static BOOL wined3d_texture_compare_from_d3d10core(enum D3D10_FILTER f) +static BOOL wined3d_texture_compare_from_d3d11(enum D3D11_FILTER f) { - return f & D3D10_FILTER_COMPARE_MASK; + return D3D11_DECODE_IS_COMPARISON_FILTER(f); } -static enum wined3d_cmp_func wined3d_cmp_func_from_d3d10core(D3D10_COMPARISON_FUNC f) +static enum wined3d_cmp_func wined3d_cmp_func_from_d3d11(D3D11_COMPARISON_FUNC f) { return (enum wined3d_cmp_func)f; } HRESULT d3d_sampler_state_init(struct d3d_sampler_state *state, struct d3d_device *device, - const D3D10_SAMPLER_DESC *desc) + const D3D11_SAMPLER_DESC *desc) { struct wined3d_sampler_desc wined3d_desc; HRESULT hr; @@ -1155,19 +1153,19 @@ HRESULT d3d_sampler_state_init(struct d3d_sampler_state *state, struct d3d_devic wined3d_private_store_init(&state->private_store); state->desc = *desc; - wined3d_desc.address_u = wined3d_texture_address_from_d3d10core(desc->AddressU); - wined3d_desc.address_v = wined3d_texture_address_from_d3d10core(desc->AddressV); - wined3d_desc.address_w = wined3d_texture_address_from_d3d10core(desc->AddressW); + wined3d_desc.address_u = wined3d_texture_address_from_d3d11(desc->AddressU); + wined3d_desc.address_v = wined3d_texture_address_from_d3d11(desc->AddressV); + wined3d_desc.address_w = wined3d_texture_address_from_d3d11(desc->AddressW); memcpy(wined3d_desc.border_color, desc->BorderColor, sizeof(wined3d_desc.border_color)); - wined3d_desc.mag_filter = wined3d_texture_filter_mag_from_d3d10core(desc->Filter); - wined3d_desc.min_filter = wined3d_texture_filter_min_from_d3d10core(desc->Filter); - wined3d_desc.mip_filter = wined3d_texture_filter_mip_from_d3d10core(desc->Filter); + wined3d_desc.mag_filter = wined3d_texture_filter_mag_from_d3d11(desc->Filter); + wined3d_desc.min_filter = wined3d_texture_filter_min_from_d3d11(desc->Filter); + 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_anisotropy = desc->Filter & D3D10_FILTER_ANISO_MASK ? desc->MaxAnisotropy : 1; - wined3d_desc.compare = wined3d_texture_compare_from_d3d10core(desc->Filter); - wined3d_desc.comparison_func = wined3d_cmp_func_from_d3d10core(desc->ComparisonFunc); + wined3d_desc.max_anisotropy = D3D11_DECODE_IS_ANISOTROPIC_FILTER(desc->Filter) ? desc->MaxAnisotropy : 1; + wined3d_desc.compare = wined3d_texture_compare_from_d3d11(desc->Filter); + wined3d_desc.comparison_func = wined3d_cmp_func_from_d3d11(desc->ComparisonFunc); wined3d_desc.srgb_decode = FALSE; if (FAILED(hr = wined3d_sampler_create(device->wined3d_device, &wined3d_desc, state, &state->wined3d_sampler)))