And ID3DDeviceContextState instead of ID3D10StateBlock.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/d2d1/bitmap.c | 83 +++++---- dlls/d2d1/brush.c | 92 +++++----- dlls/d2d1/d2d1_private.h | 36 ++-- dlls/d2d1/dc_render_target.c | 2 +- dlls/d2d1/device.c | 347 +++++++++++++++++------------------ dlls/d2d1/tests/d2d1.c | 5 +- 6 files changed, 283 insertions(+), 282 deletions(-)
diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index 7ed57052b98..470724e96a9 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -67,12 +67,12 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_Release(ID2D1Bitmap1 *iface) if (!refcount) { if (bitmap->srv) - ID3D10ShaderResourceView_Release(bitmap->srv); + ID3D11ShaderResourceView_Release(bitmap->srv); if (bitmap->rtv) - ID3D10RenderTargetView_Release(bitmap->rtv); + ID3D11RenderTargetView_Release(bitmap->rtv); if (bitmap->surface) IDXGISurface_Release(bitmap->surface); - ID3D10Resource_Release(bitmap->resource); + ID3D11Resource_Release(bitmap->resource); ID2D1Factory_Release(bitmap->factory); heap_free(bitmap); } @@ -150,8 +150,9 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromMemory(ID2D1Bitmap1 *iface, const D2D1_RECT_U *dst_rect, const void *src_data, UINT32 pitch) { struct d2d_bitmap *bitmap = impl_from_ID2D1Bitmap1(iface); - ID3D10Device *device; - D3D10_BOX box; + ID3D11DeviceContext *context; + ID3D11Device *device; + D3D11_BOX box;
TRACE("iface %p, dst_rect %p, src_data %p, pitch %u.\n", iface, dst_rect, src_data, pitch);
@@ -165,9 +166,11 @@ static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromMemory(ID2D1Bitmap1 *iface, box.back = 1; }
- ID3D10Resource_GetDevice(bitmap->resource, &device); - ID3D10Device_UpdateSubresource(device, bitmap->resource, 0, dst_rect ? &box : NULL, src_data, pitch, 0); - ID3D10Device_Release(device); + ID3D11Resource_GetDevice(bitmap->resource, &device); + ID3D11Device_GetImmediateContext(device, &context); + ID3D11DeviceContext_UpdateSubresource(context, bitmap->resource, 0, dst_rect ? &box : NULL, src_data, pitch, 0); + ID3D11DeviceContext_Release(context); + ID3D11Device_Release(device);
return S_OK; } @@ -270,15 +273,15 @@ static BOOL format_supported(const D2D1_PIXEL_FORMAT *format) }
static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context *context, - ID3D10Resource *resource, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc) + ID3D11Resource *resource, D2D1_SIZE_U size, const D2D1_BITMAP_PROPERTIES1 *desc) { - ID3D10Device *d3d_device; + ID3D11Device *d3d_device; HRESULT hr;
bitmap->ID2D1Bitmap1_iface.lpVtbl = &d2d_bitmap_vtbl; bitmap->refcount = 1; ID2D1Factory_AddRef(bitmap->factory = context->factory); - ID3D10Resource_AddRef(bitmap->resource = resource); + ID3D11Resource_AddRef(bitmap->resource = resource); bitmap->pixel_size = size; bitmap->format = desc->pixelFormat; bitmap->dpi_x = desc->dpiX; @@ -286,21 +289,21 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context bitmap->options = desc->bitmapOptions;
if (d2d_device_context_is_dxgi_target(context)) - ID3D10Resource_QueryInterface(resource, &IID_IDXGISurface, (void **)&bitmap->surface); + ID3D11Resource_QueryInterface(resource, &IID_IDXGISurface, (void **)&bitmap->surface);
- ID3D10Resource_GetDevice(resource, &d3d_device); + ID3D11Resource_GetDevice(resource, &d3d_device); if (bitmap->options & D2D1_BITMAP_OPTIONS_TARGET) { - if (FAILED(hr = ID3D10Device_CreateRenderTargetView(d3d_device, resource, NULL, &bitmap->rtv))) + if (FAILED(hr = ID3D11Device_CreateRenderTargetView(d3d_device, resource, NULL, &bitmap->rtv))) WARN("Failed to create RTV, hr %#x.\n", hr); }
if (!(bitmap->options & D2D1_BITMAP_OPTIONS_CANNOT_DRAW)) { - if (FAILED(hr = ID3D10Device_CreateShaderResourceView(d3d_device, resource, NULL, &bitmap->srv))) + if (FAILED(hr = ID3D11Device_CreateShaderResourceView(d3d_device, resource, NULL, &bitmap->srv))) WARN("Failed to create SRV, hr %#x.\n", hr); } - ID3D10Device_Release(d3d_device); + ID3D11Device_Release(d3d_device);
if (bitmap->dpi_x == 0.0f && bitmap->dpi_y == 0.0f) { @@ -312,10 +315,10 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, const void *src_data, UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) { - D3D10_SUBRESOURCE_DATA resource_data; + D3D11_SUBRESOURCE_DATA resource_data; D2D1_BITMAP_PROPERTIES1 bitmap_desc; - D3D10_TEXTURE2D_DESC texture_desc; - ID3D10Texture2D *texture; + D3D11_TEXTURE2D_DESC texture_desc; + ID3D11Texture2D *texture; HRESULT hr;
if (!format_supported(&desc->pixelFormat)) @@ -346,21 +349,21 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, texture_desc.Format = desc->pixelFormat.format; texture_desc.SampleDesc.Count = 1; texture_desc.SampleDesc.Quality = 0; - texture_desc.Usage = D3D10_USAGE_DEFAULT; + texture_desc.Usage = D3D11_USAGE_DEFAULT; texture_desc.BindFlags = 0; if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_TARGET) - texture_desc.BindFlags |= D3D10_BIND_RENDER_TARGET; + texture_desc.BindFlags |= D3D11_BIND_RENDER_TARGET; if (!(desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CANNOT_DRAW)) - texture_desc.BindFlags |= D3D10_BIND_SHADER_RESOURCE; + texture_desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; texture_desc.CPUAccessFlags = 0; texture_desc.MiscFlags = 0; if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE) - texture_desc.MiscFlags |= D3D10_RESOURCE_MISC_GDI_COMPATIBLE; + texture_desc.MiscFlags |= D3D11_RESOURCE_MISC_GDI_COMPATIBLE;
resource_data.pSysMem = src_data; resource_data.SysMemPitch = pitch;
- if (FAILED(hr = ID3D10Device_CreateTexture2D(context->d3d_device, &texture_desc, + if (FAILED(hr = ID3D11Device1_CreateTexture2D(context->d3d_device, &texture_desc, src_data ? &resource_data : NULL, &texture))) { ERR("Failed to create texture, hr %#x.\n", hr); @@ -369,10 +372,10 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size,
if ((*bitmap = heap_alloc_zero(sizeof(**bitmap)))) { - d2d_bitmap_init(*bitmap, context, (ID3D10Resource *)texture, size, desc); + d2d_bitmap_init(*bitmap, context, (ID3D11Resource *)texture, size, desc); TRACE("Created bitmap %p.\n", *bitmap); } - ID3D10Texture2D_Release(texture); + ID3D11Texture2D_Release(texture);
return *bitmap ? S_OK : E_OUTOFMEMORY; } @@ -385,7 +388,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, if (IsEqualGUID(iid, &IID_ID2D1Bitmap)) { struct d2d_bitmap *src_impl = unsafe_impl_from_ID2D1Bitmap(data); - ID3D10Device *device; + ID3D11Device *device; HRESULT hr = S_OK;
if (src_impl->factory != context->factory) @@ -394,9 +397,9 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, goto failed; }
- ID3D10Resource_GetDevice(src_impl->resource, &device); - ID3D10Device_Release(device); - if (device != context->d3d_device) + ID3D11Resource_GetDevice(src_impl->resource, &device); + ID3D11Device_Release(device); + if (device != (ID3D11Device *)context->d3d_device) { hr = D2DERR_UNSUPPORTED_OPERATION; goto failed; @@ -437,28 +440,28 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, { DXGI_SURFACE_DESC surface_desc; IDXGISurface *surface = data; - ID3D10Resource *resource; + ID3D11Resource *resource; D2D1_SIZE_U pixel_size; - ID3D10Device *device; + ID3D11Device *device; HRESULT hr;
- if (FAILED(IDXGISurface_QueryInterface(surface, &IID_ID3D10Resource, (void **)&resource))) + if (FAILED(IDXGISurface_QueryInterface(surface, &IID_ID3D11Resource, (void **)&resource))) { WARN("Failed to get d3d resource from dxgi surface.\n"); return E_FAIL; }
- ID3D10Resource_GetDevice(resource, &device); - ID3D10Device_Release(device); - if (device != context->d3d_device) + ID3D11Resource_GetDevice(resource, &device); + ID3D11Device_Release(device); + if (device != (ID3D11Device *)context->d3d_device) { - ID3D10Resource_Release(resource); + ID3D11Resource_Release(resource); return D2DERR_UNSUPPORTED_OPERATION; }
if (!(*bitmap = heap_alloc_zero(sizeof(**bitmap)))) { - ID3D10Resource_Release(resource); + ID3D11Resource_Release(resource); return E_OUTOFMEMORY; }
@@ -466,7 +469,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc))) { WARN("Failed to get surface desc, hr %#x.\n", hr); - ID3D10Resource_Release(resource); + ID3D11Resource_Release(resource); return hr; }
@@ -494,7 +497,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, pixel_size.height = surface_desc.Height;
d2d_bitmap_init(*bitmap, context, resource, pixel_size, &d); - ID3D10Resource_Release(resource); + ID3D11Resource_Release(resource); TRACE("Created bitmap %p.\n", *bitmap);
return S_OK; diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 07d2e26a143..2bbb6113984 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -65,7 +65,7 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection if (!refcount) { heap_free(gradient->stops); - ID3D10ShaderResourceView_Release(gradient->view); + ID3D11ShaderResourceView_Release(gradient->view); ID2D1Factory_Release(gradient->factory); heap_free(gradient); } @@ -127,15 +127,15 @@ static const struct ID2D1GradientStopCollectionVtbl d2d_gradient_vtbl = d2d_gradient_GetExtendMode, };
-HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D2D1_GRADIENT_STOP *stops, +HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D11Device1 *device, const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode, struct d2d_gradient **gradient) { - D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc; - D3D10_SUBRESOURCE_DATA buffer_data; - ID3D10ShaderResourceView *view; - D3D10_BUFFER_DESC buffer_desc; + D3D11_SHADER_RESOURCE_VIEW_DESC srv_desc; + D3D11_SUBRESOURCE_DATA buffer_data; + ID3D11ShaderResourceView *view; + D3D11_BUFFER_DESC buffer_desc; struct d2d_vec4 *data; - ID3D10Buffer *buffer; + ID3D11Buffer *buffer; unsigned int i; HRESULT hr;
@@ -155,8 +155,8 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D }
buffer_desc.ByteWidth = 2 * stop_count * sizeof(*data); - buffer_desc.Usage = D3D10_USAGE_DEFAULT; - buffer_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0;
@@ -164,7 +164,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &buffer_data, &buffer); + hr = ID3D11Device1_CreateBuffer(device, &buffer_desc, &buffer_data, &buffer); heap_free(data); if (FAILED(hr)) { @@ -173,12 +173,12 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D }
srv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; - srv_desc.ViewDimension = D3D10_SRV_DIMENSION_BUFFER; + srv_desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; srv_desc.Buffer.ElementOffset = 0; srv_desc.Buffer.ElementWidth = 2 * stop_count;
- hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer, &srv_desc, &view); - ID3D10Buffer_Release(buffer); + hr = ID3D11Device1_CreateShaderResourceView(device, (ID3D11Resource *)buffer, &srv_desc, &view); + ID3D11Buffer_Release(buffer); if (FAILED(hr)) { ERR("Failed to create view, hr %#x.\n", hr); @@ -187,7 +187,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D
if (!(*gradient = heap_alloc_zero(sizeof(**gradient)))) { - ID3D10ShaderResourceView_Release(view); + ID3D11ShaderResourceView_Release(view); return E_OUTOFMEMORY; }
@@ -204,7 +204,7 @@ HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D (*gradient)->stop_count = stop_count; if (!((*gradient)->stops = heap_calloc(stop_count, sizeof(*stops)))) { - ID3D10ShaderResourceView_Release(view); + ID3D11ShaderResourceView_Release(view); heap_free(*gradient); return E_OUTOFMEMORY; } @@ -222,9 +222,12 @@ static struct d2d_gradient *unsafe_impl_from_ID2D1GradientStopCollection(ID2D1Gr return CONTAINING_RECORD(iface, struct d2d_gradient, ID2D1GradientStopCollection_iface); }
-static void d2d_gradient_bind(struct d2d_gradient *gradient, ID3D10Device *device, unsigned int brush_idx) +static void d2d_gradient_bind(struct d2d_gradient *gradient, ID3D11Device1 *device, unsigned int brush_idx) { - ID3D10Device_PSSetShaderResources(device, 2 + brush_idx, 1, &gradient->view); + ID3D11DeviceContext *context; + ID3D11Device1_GetImmediateContext(device, &context); + ID3D11DeviceContext_PSSetShaderResources(context, 2 + brush_idx, 1, &gradient->view); + ID3D11DeviceContext_Release(context); }
static void d2d_brush_destroy(struct d2d_brush *brush) @@ -860,7 +863,7 @@ static ULONG STDMETHODCALLTYPE d2d_bitmap_brush_Release(ID2D1BitmapBrush1 *iface if (!refcount) { if (brush->u.bitmap.sampler_state) - ID3D10SamplerState_Release(brush->u.bitmap.sampler_state); + ID3D11SamplerState_Release(brush->u.bitmap.sampler_state); if (brush->u.bitmap.bitmap) ID2D1Bitmap1_Release(&brush->u.bitmap.bitmap->ID2D1Bitmap1_iface); d2d_brush_destroy(brush); @@ -926,7 +929,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeX(ID2D1BitmapBrush1 brush->u.bitmap.extend_mode_x = mode; if (brush->u.bitmap.sampler_state) { - ID3D10SamplerState_Release(brush->u.bitmap.sampler_state); + ID3D11SamplerState_Release(brush->u.bitmap.sampler_state); brush->u.bitmap.sampler_state = NULL; } } @@ -940,7 +943,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetExtendModeY(ID2D1BitmapBrush1 brush->u.bitmap.extend_mode_y = mode; if (brush->u.bitmap.sampler_state) { - ID3D10SamplerState_Release(brush->u.bitmap.sampler_state); + ID3D11SamplerState_Release(brush->u.bitmap.sampler_state); brush->u.bitmap.sampler_state = NULL; } } @@ -965,7 +968,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode(ID2D1BitmapB brush->u.bitmap.interpolation_mode = d2d1_1_interp_mode_from_d2d1(mode); if (brush->u.bitmap.sampler_state) { - ID3D10SamplerState_Release(brush->u.bitmap.sampler_state); + ID3D11SamplerState_Release(brush->u.bitmap.sampler_state); brush->u.bitmap.sampler_state = NULL; } } @@ -1053,7 +1056,7 @@ static void STDMETHODCALLTYPE d2d_bitmap_brush_SetInterpolationMode1(ID2D1Bitmap brush->u.bitmap.interpolation_mode = mode; if (brush->u.bitmap.sampler_state) { - ID3D10SamplerState_Release(brush->u.bitmap.sampler_state); + ID3D11SamplerState_Release(brush->u.bitmap.sampler_state); brush->u.bitmap.sampler_state = NULL; } } @@ -1128,19 +1131,19 @@ struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface); }
-static D3D10_TEXTURE_ADDRESS_MODE texture_address_mode_from_extend_mode(D2D1_EXTEND_MODE mode) +static D3D11_TEXTURE_ADDRESS_MODE texture_address_mode_from_extend_mode(D2D1_EXTEND_MODE mode) { switch (mode) { case D2D1_EXTEND_MODE_CLAMP: - return D3D10_TEXTURE_ADDRESS_CLAMP; + return D3D11_TEXTURE_ADDRESS_CLAMP; case D2D1_EXTEND_MODE_WRAP: - return D3D10_TEXTURE_ADDRESS_WRAP; + return D3D11_TEXTURE_ADDRESS_WRAP; case D2D1_EXTEND_MODE_MIRROR: - return D3D10_TEXTURE_ADDRESS_MIRROR; + return D3D11_TEXTURE_ADDRESS_MIRROR; default: FIXME("Unhandled extend mode %#x.\n", mode); - return D3D10_TEXTURE_ADDRESS_CLAMP; + return D3D11_TEXTURE_ADDRESS_CLAMP; } }
@@ -1262,11 +1265,11 @@ static BOOL d2d_brush_fill_cb(const struct d2d_brush *brush, }
HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_brush, - BOOL outline, BOOL is_arc, struct d2d_device_context *render_target, ID3D10Buffer **ps_cb) + BOOL outline, BOOL is_arc, struct d2d_device_context *render_target, ID3D11Buffer **ps_cb) { - D3D10_SUBRESOURCE_DATA buffer_data; + D3D11_SUBRESOURCE_DATA buffer_data; struct d2d_ps_cb cb_data = {0}; - D3D10_BUFFER_DESC buffer_desc; + D3D11_BUFFER_DESC buffer_desc; HRESULT hr;
cb_data.outline = outline; @@ -1277,8 +1280,8 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_b return E_NOTIMPL;
buffer_desc.ByteWidth = sizeof(cb_data); - buffer_desc.Usage = D3D10_USAGE_DEFAULT; - buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0;
@@ -1286,31 +1289,33 @@ HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_b buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, ps_cb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, ps_cb))) ERR("Failed to create constant buffer, hr %#x.\n", hr);
return hr; }
-static void d2d_brush_bind_bitmap(struct d2d_brush *brush, ID3D10Device *device, unsigned int brush_idx) +static void d2d_brush_bind_bitmap(struct d2d_brush *brush, ID3D11Device1 *device, unsigned int brush_idx) { + ID3D11DeviceContext *context; HRESULT hr;
- ID3D10Device_PSSetShaderResources(device, brush_idx, 1, &brush->u.bitmap.bitmap->srv); + ID3D11Device1_GetImmediateContext(device, &context); + ID3D11DeviceContext_PSSetShaderResources(context, brush_idx, 1, &brush->u.bitmap.bitmap->srv); if (!brush->u.bitmap.sampler_state) { - D3D10_SAMPLER_DESC sampler_desc; + D3D11_SAMPLER_DESC sampler_desc;
if (brush->u.bitmap.interpolation_mode == D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR) - sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_POINT; + sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; else - sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; + sampler_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; sampler_desc.AddressU = texture_address_mode_from_extend_mode(brush->u.bitmap.extend_mode_x); sampler_desc.AddressV = texture_address_mode_from_extend_mode(brush->u.bitmap.extend_mode_y); - sampler_desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sampler_desc.MipLODBias = 0.0f; sampler_desc.MaxAnisotropy = 0; - sampler_desc.ComparisonFunc = D3D10_COMPARISON_NEVER; + sampler_desc.ComparisonFunc = D3D11_COMPARISON_NEVER; sampler_desc.BorderColor[0] = 0.0f; sampler_desc.BorderColor[1] = 0.0f; sampler_desc.BorderColor[2] = 0.0f; @@ -1318,14 +1323,15 @@ static void d2d_brush_bind_bitmap(struct d2d_brush *brush, ID3D10Device *device, sampler_desc.MinLOD = 0.0f; sampler_desc.MaxLOD = 0.0f;
- if (FAILED(hr = ID3D10Device_CreateSamplerState(device, + if (FAILED(hr = ID3D11Device1_CreateSamplerState(device, &sampler_desc, &brush->u.bitmap.sampler_state))) ERR("Failed to create sampler state, hr %#x.\n", hr); } - ID3D10Device_PSSetSamplers(device, brush_idx, 1, &brush->u.bitmap.sampler_state); + ID3D11DeviceContext_PSSetSamplers(context, brush_idx, 1, &brush->u.bitmap.sampler_state); + ID3D11DeviceContext_Release(context); }
-void d2d_brush_bind_resources(struct d2d_brush *brush, ID3D10Device *device, unsigned int brush_idx) +void d2d_brush_bind_resources(struct d2d_brush *brush, ID3D11Device1 *device, unsigned int brush_idx) { switch (brush->type) { diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 4546d5c1e3a..9a20160d331 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -27,7 +27,7 @@ #include <math.h> #define COBJMACROS #include "d2d1_2.h" -#include "d3d11.h" +#include "d3d11_1.h" #ifdef D2D1_INIT_GUID #include "initguid.h" #endif @@ -73,8 +73,8 @@ struct d2d_error_state
struct d2d_shape_resources { - ID3D10InputLayout *il; - ID3D10VertexShader *vs; + ID3D11InputLayout *il; + ID3D11VertexShader *vs; };
struct d2d_brush_cb @@ -139,16 +139,16 @@ struct d2d_device_context
ID2D1Factory *factory; ID2D1Device *device; - ID3D10Device *d3d_device; + ID3D11Device1 *d3d_device; + ID3DDeviceContextState *d3d_state; struct d2d_bitmap *target; - ID3D10StateBlock *stateblock; struct d2d_shape_resources shape_resources[D2D_SHAPE_TYPE_COUNT]; - ID3D10PixelShader *ps; - ID3D10Buffer *ib; + ID3D11PixelShader *ps; + ID3D11Buffer *ib; unsigned int vb_stride; - ID3D10Buffer *vb; - ID3D10RasterizerState *rs; - ID3D10BlendState *bs; + ID3D11Buffer *vb; + ID3D11RasterizerState *rs; + ID3D11BlendState *bs;
struct d2d_error_state error; D2D1_DRAWING_STATE_DESCRIPTION1 drawing_state; @@ -243,12 +243,12 @@ struct d2d_gradient LONG refcount;
ID2D1Factory *factory; - ID3D10ShaderResourceView *view; + ID3D11ShaderResourceView *view; D2D1_GRADIENT_STOP *stops; UINT32 stop_count; };
-HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D10Device *device, const D2D1_GRADIENT_STOP *stops, +HRESULT d2d_gradient_create(ID2D1Factory *factory, ID3D11Device1 *device, const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode, struct d2d_gradient **gradient) DECLSPEC_HIDDEN;
@@ -287,7 +287,7 @@ struct d2d_brush D2D1_EXTEND_MODE extend_mode_x; D2D1_EXTEND_MODE extend_mode_y; D2D1_INTERPOLATION_MODE interpolation_mode; - ID3D10SamplerState *sampler_state; + ID3D11SamplerState *sampler_state; } bitmap; } u; }; @@ -303,9 +303,9 @@ HRESULT d2d_radial_gradient_brush_create(ID2D1Factory *factory, HRESULT d2d_bitmap_brush_create(ID2D1Factory *factory, ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmap_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, struct d2d_brush **brush) DECLSPEC_HIDDEN; -void d2d_brush_bind_resources(struct d2d_brush *brush, ID3D10Device *device, unsigned int brush_idx) DECLSPEC_HIDDEN; +void d2d_brush_bind_resources(struct d2d_brush *brush, ID3D11Device1 *device, unsigned int brush_idx) DECLSPEC_HIDDEN; HRESULT d2d_brush_get_ps_cb(struct d2d_brush *brush, struct d2d_brush *opacity_brush, BOOL outline, BOOL is_arc, - struct d2d_device_context *render_target, ID3D10Buffer **ps_cb) DECLSPEC_HIDDEN; + struct d2d_device_context *render_target, ID3D11Buffer **ps_cb) DECLSPEC_HIDDEN; struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) DECLSPEC_HIDDEN;
struct d2d_stroke_style @@ -349,10 +349,10 @@ struct d2d_bitmap LONG refcount;
ID2D1Factory *factory; - ID3D10ShaderResourceView *srv; - ID3D10RenderTargetView *rtv; + ID3D11ShaderResourceView *srv; + ID3D11RenderTargetView *rtv; IDXGISurface *surface; - ID3D10Resource *resource; + ID3D11Resource *resource; D2D1_SIZE_U pixel_size; D2D1_PIXEL_FORMAT format; float dpi_x; diff --git a/dlls/d2d1/dc_render_target.c b/dlls/d2d1/dc_render_target.c index 47aa99697d7..099e3b0a3a2 100644 --- a/dlls/d2d1/dc_render_target.c +++ b/dlls/d2d1/dc_render_target.c @@ -715,7 +715,7 @@ static HRESULT STDMETHODCALLTYPE d2d_dc_render_target_BindDC(ID2D1DCRenderTarget }
bitmap_impl = unsafe_impl_from_ID2D1Bitmap(bitmap); - ID3D10Resource_QueryInterface(bitmap_impl->resource, &IID_IDXGISurface1, (void **)&dxgi_surface); + ID3D11Resource_QueryInterface(bitmap_impl->resource, &IID_IDXGISurface1, (void **)&dxgi_surface);
ID2D1DeviceContext_SetTarget(context, (ID2D1Image *)bitmap); ID2D1Bitmap_Release(bitmap); diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 23ce03dce5e..f6a6c019d9d 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -118,15 +118,16 @@ static void d2d_clip_stack_pop(struct d2d_clip_stack *stack) }
static void d2d_device_context_draw(struct d2d_device_context *render_target, enum d2d_shape_type shape_type, - ID3D10Buffer *ib, unsigned int index_count, ID3D10Buffer *vb, unsigned int vb_stride, - ID3D10Buffer *vs_cb, ID3D10Buffer *ps_cb, struct d2d_brush *brush, struct d2d_brush *opacity_brush) + ID3D11Buffer *ib, unsigned int index_count, ID3D11Buffer *vb, unsigned int vb_stride, + ID3D11Buffer *vs_cb, ID3D11Buffer *ps_cb, struct d2d_brush *brush, struct d2d_brush *opacity_brush) { struct d2d_shape_resources *shape_resources = &render_target->shape_resources[shape_type]; - ID3D10Device *device = render_target->d3d_device; - D3D10_RECT scissor_rect; + ID3DDeviceContextState *prev_state; + ID3D11Device1 *device = render_target->d3d_device; + ID3D11DeviceContext1 *context; + D3D11_RECT scissor_rect; unsigned int offset; - D3D10_VIEWPORT vp; - HRESULT hr; + D3D11_VIEWPORT vp;
vp.TopLeftX = 0; vp.TopLeftY = 0; @@ -135,24 +136,20 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f;
- if (FAILED(hr = render_target->stateblock->lpVtbl->Capture(render_target->stateblock))) - { - WARN("Failed to capture stateblock, hr %#x.\n", hr); - return; - } - - ID3D10Device_ClearState(device); + ID3D11Device1_GetImmediateContext1(device, &context); + ID3D11DeviceContext1_SwapDeviceContextState(context, render_target->d3d_state, &prev_state); + ID3D11DeviceContext1_ClearState(context);
- ID3D10Device_IASetInputLayout(device, shape_resources->il); - ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - ID3D10Device_IASetIndexBuffer(device, ib, DXGI_FORMAT_R16_UINT, 0); + ID3D11DeviceContext1_IASetInputLayout(context, shape_resources->il); + ID3D11DeviceContext1_IASetPrimitiveTopology(context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D11DeviceContext1_IASetIndexBuffer(context, ib, DXGI_FORMAT_R16_UINT, 0); offset = 0; - ID3D10Device_IASetVertexBuffers(device, 0, 1, &vb, &vb_stride, &offset); - ID3D10Device_VSSetConstantBuffers(device, 0, 1, &vs_cb); - ID3D10Device_VSSetShader(device, shape_resources->vs); - ID3D10Device_PSSetConstantBuffers(device, 0, 1, &ps_cb); - ID3D10Device_PSSetShader(device, render_target->ps); - ID3D10Device_RSSetViewports(device, 1, &vp); + ID3D11DeviceContext1_IASetVertexBuffers(context, 0, 1, &vb, &vb_stride, &offset); + ID3D11DeviceContext1_VSSetConstantBuffers(context, 0, 1, &vs_cb); + ID3D11DeviceContext1_VSSetShader(context, shape_resources->vs, NULL, 0); + ID3D11DeviceContext1_PSSetConstantBuffers(context, 0, 1, &ps_cb); + ID3D11DeviceContext1_PSSetShader(context, render_target->ps, NULL, 0); + ID3D11DeviceContext1_RSSetViewports(context, 1, &vp); if (render_target->clip_stack.count) { const D2D1_RECT_F *clip_rect; @@ -170,24 +167,25 @@ static void d2d_device_context_draw(struct d2d_device_context *render_target, en scissor_rect.right = render_target->pixel_size.width; scissor_rect.bottom = render_target->pixel_size.height; } - ID3D10Device_RSSetScissorRects(device, 1, &scissor_rect); - ID3D10Device_RSSetState(device, render_target->rs); - ID3D10Device_OMSetRenderTargets(device, 1, &render_target->target->rtv, NULL); + ID3D11DeviceContext1_RSSetScissorRects(context, 1, &scissor_rect); + ID3D11DeviceContext1_RSSetState(context, render_target->rs); + ID3D11DeviceContext1_OMSetRenderTargets(context, 1, &render_target->target->rtv, NULL); if (brush) { - ID3D10Device_OMSetBlendState(device, render_target->bs, NULL, D3D10_DEFAULT_SAMPLE_MASK); + ID3D11DeviceContext1_OMSetBlendState(context, render_target->bs, NULL, D3D11_DEFAULT_SAMPLE_MASK); d2d_brush_bind_resources(brush, device, 0); } if (opacity_brush) d2d_brush_bind_resources(opacity_brush, device, 1);
if (ib) - ID3D10Device_DrawIndexed(device, index_count, 0, 0); + ID3D11DeviceContext1_DrawIndexed(context, index_count, 0, 0); else - ID3D10Device_Draw(device, index_count, 0); + ID3D11DeviceContext1_Draw(context, index_count, 0);
- if (FAILED(hr = render_target->stateblock->lpVtbl->Apply(render_target->stateblock))) - WARN("Failed to apply stateblock, hr %#x.\n", hr); + ID3D11DeviceContext1_SwapDeviceContextState(context, prev_state, NULL); + ID3D11DeviceContext1_Release(context); + ID3DDeviceContextState_Release(prev_state); }
static void d2d_device_context_set_error(struct d2d_device_context *context, HRESULT code) @@ -261,20 +259,20 @@ static ULONG STDMETHODCALLTYPE d2d_device_context_inner_Release(IUnknown *iface) if (context->text_rendering_params) IDWriteRenderingParams_Release(context->text_rendering_params); if (context->bs) - ID3D10BlendState_Release(context->bs); - ID3D10RasterizerState_Release(context->rs); - ID3D10Buffer_Release(context->vb); - ID3D10Buffer_Release(context->ib); - ID3D10PixelShader_Release(context->ps); + ID3D11BlendState_Release(context->bs); + ID3D11RasterizerState_Release(context->rs); + ID3D11Buffer_Release(context->vb); + ID3D11Buffer_Release(context->ib); + ID3D11PixelShader_Release(context->ps); for (i = 0; i < D2D_SHAPE_TYPE_COUNT; ++i) { - ID3D10VertexShader_Release(context->shape_resources[i].vs); - ID3D10InputLayout_Release(context->shape_resources[i].il); + ID3D11VertexShader_Release(context->shape_resources[i].vs); + ID3D11InputLayout_Release(context->shape_resources[i].il); } - context->stateblock->lpVtbl->Release(context->stateblock); + ID3DDeviceContextState_Release(context->d3d_state); if (context->target) ID2D1Bitmap1_Release(&context->target->ID2D1Bitmap1_iface); - ID3D10Device_Release(context->d3d_device); + ID3D11Device1_Release(context->d3d_device); ID2D1Factory_Release(context->factory); ID2D1Device_Release(context->device); heap_free(context); @@ -698,9 +696,9 @@ static void STDMETHODCALLTYPE d2d_device_context_FillEllipse(ID2D1DeviceContext static void d2d_device_context_draw_geometry(struct d2d_device_context *render_target, const struct d2d_geometry *geometry, struct d2d_brush *brush, float stroke_width) { - ID3D10Buffer *ib, *vb, *vs_cb, *ps_cb_bezier, *ps_cb_arc; - D3D10_SUBRESOURCE_DATA buffer_data; - D3D10_BUFFER_DESC buffer_desc; + ID3D11Buffer *ib, *vb, *vs_cb, *ps_cb_bezier, *ps_cb_arc; + D3D11_SUBRESOURCE_DATA buffer_data; + D3D11_BUFFER_DESC buffer_desc; const D2D1_MATRIX_3X2_F *w; float tmp_x, tmp_y; HRESULT hr; @@ -739,8 +737,8 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t vs_cb_data.transform_rty.w = -2.0f / render_target->pixel_size.height;
buffer_desc.ByteWidth = sizeof(vs_cb_data); - buffer_desc.Usage = D3D10_USAGE_DEFAULT; - buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0;
@@ -748,7 +746,7 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vs_cb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vs_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); return; @@ -757,68 +755,68 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t if (FAILED(hr = d2d_brush_get_ps_cb(brush, NULL, TRUE, FALSE, render_target, &ps_cb_bezier))) { WARN("Failed to get ps constant buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(vs_cb); + ID3D11Buffer_Release(vs_cb); return; }
if (FAILED(hr = d2d_brush_get_ps_cb(brush, NULL, TRUE, TRUE, render_target, &ps_cb_arc))) { WARN("Failed to get ps constant buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(vs_cb); - ID3D10Buffer_Release(ps_cb_bezier); + ID3D11Buffer_Release(vs_cb); + ID3D11Buffer_Release(ps_cb_bezier); return; }
if (geometry->outline.face_count) { buffer_desc.ByteWidth = geometry->outline.face_count * sizeof(*geometry->outline.faces); - buffer_desc.BindFlags = D3D10_BIND_INDEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->outline.faces;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create index buffer, hr %#x.\n", hr); goto done; }
buffer_desc.ByteWidth = geometry->outline.vertex_count * sizeof(*geometry->outline.vertices); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->outline.vertices;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create vertex buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(ib); goto done; }
d2d_device_context_draw(render_target, D2D_SHAPE_TYPE_OUTLINE, ib, 3 * geometry->outline.face_count, vb, sizeof(*geometry->outline.vertices), vs_cb, ps_cb_bezier, brush, NULL);
- ID3D10Buffer_Release(vb); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(vb); + ID3D11Buffer_Release(ib); }
if (geometry->outline.bezier_face_count) { buffer_desc.ByteWidth = geometry->outline.bezier_face_count * sizeof(*geometry->outline.bezier_faces); - buffer_desc.BindFlags = D3D10_BIND_INDEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->outline.bezier_faces;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create beziers index buffer, hr %#x.\n", hr); goto done; }
buffer_desc.ByteWidth = geometry->outline.bezier_count * sizeof(*geometry->outline.beziers); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->outline.beziers;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create beziers vertex buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(ib); goto done; }
@@ -826,30 +824,30 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t 3 * geometry->outline.bezier_face_count, vb, sizeof(*geometry->outline.beziers), vs_cb, ps_cb_bezier, brush, NULL);
- ID3D10Buffer_Release(vb); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(vb); + ID3D11Buffer_Release(ib); }
if (geometry->outline.arc_face_count) { buffer_desc.ByteWidth = geometry->outline.arc_face_count * sizeof(*geometry->outline.arc_faces); - buffer_desc.BindFlags = D3D10_BIND_INDEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->outline.arc_faces;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create arcs index buffer, hr %#x.\n", hr); goto done; }
buffer_desc.ByteWidth = geometry->outline.arc_count * sizeof(*geometry->outline.arcs); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->outline.arcs;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create arcs vertex buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(ib); goto done; }
@@ -857,14 +855,14 @@ static void d2d_device_context_draw_geometry(struct d2d_device_context *render_t 3 * geometry->outline.arc_face_count, vb, sizeof(*geometry->outline.arcs), vs_cb, ps_cb_arc, brush, NULL);
- ID3D10Buffer_Release(vb); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(vb); + ID3D11Buffer_Release(ib); }
done: - ID3D10Buffer_Release(ps_cb_arc); - ID3D10Buffer_Release(ps_cb_bezier); - ID3D10Buffer_Release(vs_cb); + ID3D11Buffer_Release(ps_cb_arc); + ID3D11Buffer_Release(ps_cb_bezier); + ID3D11Buffer_Release(vs_cb); }
static void STDMETHODCALLTYPE d2d_device_context_DrawGeometry(ID2D1DeviceContext *iface, @@ -886,9 +884,9 @@ static void STDMETHODCALLTYPE d2d_device_context_DrawGeometry(ID2D1DeviceContext static void d2d_device_context_fill_geometry(struct d2d_device_context *render_target, const struct d2d_geometry *geometry, struct d2d_brush *brush, struct d2d_brush *opacity_brush) { - ID3D10Buffer *ib, *vb, *vs_cb, *ps_cb_bezier, *ps_cb_arc; - D3D10_SUBRESOURCE_DATA buffer_data; - D3D10_BUFFER_DESC buffer_desc; + ID3D11Buffer *ib, *vb, *vs_cb, *ps_cb_bezier, *ps_cb_arc; + D3D11_SUBRESOURCE_DATA buffer_data; + D3D11_BUFFER_DESC buffer_desc; D2D1_MATRIX_3X2_F *w; float tmp_x, tmp_y; HRESULT hr; @@ -927,8 +925,8 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t vs_cb_data.transform_rty.w = -2.0f / render_target->pixel_size.height;
buffer_desc.ByteWidth = sizeof(vs_cb_data); - buffer_desc.Usage = D3D10_USAGE_DEFAULT; - buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0;
@@ -936,7 +934,7 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vs_cb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vs_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); return; @@ -945,55 +943,55 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t if (FAILED(hr = d2d_brush_get_ps_cb(brush, opacity_brush, FALSE, FALSE, render_target, &ps_cb_bezier))) { WARN("Failed to get ps constant buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(vs_cb); + ID3D11Buffer_Release(vs_cb); return; }
if (FAILED(hr = d2d_brush_get_ps_cb(brush, opacity_brush, FALSE, TRUE, render_target, &ps_cb_arc))) { WARN("Failed to get ps constant buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(vs_cb); - ID3D10Buffer_Release(ps_cb_bezier); + ID3D11Buffer_Release(vs_cb); + ID3D11Buffer_Release(ps_cb_bezier); return; }
if (geometry->fill.face_count) { buffer_desc.ByteWidth = geometry->fill.face_count * sizeof(*geometry->fill.faces); - buffer_desc.BindFlags = D3D10_BIND_INDEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_data.pSysMem = geometry->fill.faces;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ib))) { WARN("Failed to create index buffer, hr %#x.\n", hr); goto done; }
buffer_desc.ByteWidth = geometry->fill.vertex_count * sizeof(*geometry->fill.vertices); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->fill.vertices;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create vertex buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(ib); goto done; }
d2d_device_context_draw(render_target, D2D_SHAPE_TYPE_TRIANGLE, ib, 3 * geometry->fill.face_count, vb, sizeof(*geometry->fill.vertices), vs_cb, ps_cb_bezier, brush, opacity_brush);
- ID3D10Buffer_Release(vb); - ID3D10Buffer_Release(ib); + ID3D11Buffer_Release(vb); + ID3D11Buffer_Release(ib); }
if (geometry->fill.bezier_vertex_count) { buffer_desc.ByteWidth = geometry->fill.bezier_vertex_count * sizeof(*geometry->fill.bezier_vertices); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->fill.bezier_vertices;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create beziers vertex buffer, hr %#x.\n", hr); goto done; @@ -1002,16 +1000,16 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t d2d_device_context_draw(render_target, D2D_SHAPE_TYPE_CURVE, NULL, geometry->fill.bezier_vertex_count, vb, sizeof(*geometry->fill.bezier_vertices), vs_cb, ps_cb_bezier, brush, opacity_brush);
- ID3D10Buffer_Release(vb); + ID3D11Buffer_Release(vb); }
if (geometry->fill.arc_vertex_count) { buffer_desc.ByteWidth = geometry->fill.arc_vertex_count * sizeof(*geometry->fill.arc_vertices); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = geometry->fill.arc_vertices;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vb))) { ERR("Failed to create arc vertex buffer, hr %#x.\n", hr); goto done; @@ -1020,13 +1018,13 @@ static void d2d_device_context_fill_geometry(struct d2d_device_context *render_t d2d_device_context_draw(render_target, D2D_SHAPE_TYPE_CURVE, NULL, geometry->fill.arc_vertex_count, vb, sizeof(*geometry->fill.arc_vertices), vs_cb, ps_cb_arc, brush, opacity_brush);
- ID3D10Buffer_Release(vb); + ID3D11Buffer_Release(vb); }
done: - ID3D10Buffer_Release(ps_cb_arc); - ID3D10Buffer_Release(ps_cb_bezier); - ID3D10Buffer_Release(vs_cb); + ID3D11Buffer_Release(ps_cb_arc); + ID3D11Buffer_Release(ps_cb_bezier); + ID3D11Buffer_Release(vs_cb); }
static void STDMETHODCALLTYPE d2d_device_context_FillGeometry(ID2D1DeviceContext *iface, @@ -1622,10 +1620,10 @@ static void STDMETHODCALLTYPE d2d_device_context_PopAxisAlignedClip(ID2D1DeviceC static void STDMETHODCALLTYPE d2d_device_context_Clear(ID2D1DeviceContext *iface, const D2D1_COLOR_F *colour) { struct d2d_device_context *render_target = impl_from_ID2D1DeviceContext(iface); - D3D10_SUBRESOURCE_DATA buffer_data; + D3D11_SUBRESOURCE_DATA buffer_data; struct d2d_ps_cb ps_cb_data = {0}; - D3D10_BUFFER_DESC buffer_desc; - ID3D10Buffer *vs_cb, *ps_cb; + D3D11_BUFFER_DESC buffer_desc; + ID3D11Buffer *vs_cb, *ps_cb; D2D1_COLOR_F *c; HRESULT hr;
@@ -1650,8 +1648,8 @@ static void STDMETHODCALLTYPE d2d_device_context_Clear(ID2D1DeviceContext *iface TRACE("iface %p, colour %p.\n", iface, colour);
buffer_desc.ByteWidth = sizeof(vs_cb_data); - buffer_desc.Usage = D3D10_USAGE_DEFAULT; - buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0;
@@ -1659,7 +1657,7 @@ static void STDMETHODCALLTYPE d2d_device_context_Clear(ID2D1DeviceContext *iface buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vs_cb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &vs_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); return; @@ -1682,18 +1680,18 @@ static void STDMETHODCALLTYPE d2d_device_context_Clear(ID2D1DeviceContext *iface buffer_desc.ByteWidth = sizeof(ps_cb_data); buffer_data.pSysMem = &ps_cb_data;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ps_cb))) + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &ps_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); - ID3D10Buffer_Release(vs_cb); + ID3D11Buffer_Release(vs_cb); return; }
d2d_device_context_draw(render_target, D2D_SHAPE_TYPE_TRIANGLE, render_target->ib, 6, render_target->vb, render_target->vb_stride, vs_cb, ps_cb, NULL, NULL);
- ID3D10Buffer_Release(ps_cb); - ID3D10Buffer_Release(vs_cb); + ID3D11Buffer_Release(ps_cb); + ID3D11Buffer_Release(vs_cb); }
static void STDMETHODCALLTYPE d2d_device_context_BeginDraw(ID2D1DeviceContext *iface) @@ -2022,7 +2020,7 @@ static void d2d_device_context_reset_target(struct d2d_device_context *context) memset(&context->desc.pixelFormat, 0, sizeof(context->desc.pixelFormat)); memset(&context->pixel_size, 0, sizeof(context->pixel_size));
- ID3D10BlendState_Release(context->bs); + ID3D11BlendState_Release(context->bs); context->bs = NULL; }
@@ -2030,7 +2028,7 @@ static void STDMETHODCALLTYPE d2d_device_context_SetTarget(ID2D1DeviceContext *i { struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); struct d2d_bitmap *bitmap_impl; - D3D10_BLEND_DESC blend_desc; + D3D11_BLEND_DESC blend_desc; ID2D1Bitmap *bitmap; HRESULT hr;
@@ -2064,23 +2062,24 @@ static void STDMETHODCALLTYPE d2d_device_context_SetTarget(ID2D1DeviceContext *i context->target = bitmap_impl;
memset(&blend_desc, 0, sizeof(blend_desc)); - blend_desc.BlendEnable[0] = TRUE; - blend_desc.SrcBlend = D3D10_BLEND_ONE; - blend_desc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA; - blend_desc.BlendOp = D3D10_BLEND_OP_ADD; + blend_desc.IndependentBlendEnable = FALSE; + blend_desc.RenderTarget[0].BlendEnable = TRUE; + blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE; + blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blend_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; if (context->desc.pixelFormat.alphaMode == D2D1_ALPHA_MODE_IGNORE) { - blend_desc.SrcBlendAlpha = D3D10_BLEND_ZERO; - blend_desc.DestBlendAlpha = D3D10_BLEND_ONE; + blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO; + blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE; } else { - blend_desc.SrcBlendAlpha = D3D10_BLEND_ONE; - blend_desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; } - blend_desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; - blend_desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; - if (FAILED(hr = ID3D10Device_CreateBlendState(context->d3d_device, &blend_desc, &context->bs))) + blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + if (FAILED(hr = ID3D11Device1_CreateBlendState(context->d3d_device, &blend_desc, &context->bs))) WARN("Failed to create blend state, hr %#x.\n", hr); }
@@ -2742,12 +2741,12 @@ static ULONG STDMETHODCALLTYPE d2d_gdi_interop_render_target_Release(ID2D1GdiInt
static HRESULT d2d_device_context_get_surface(struct d2d_device_context *render_target, IDXGISurface1 **surface) { - ID3D10Resource *resource; + ID3D11Resource *resource; HRESULT hr;
- ID3D10RenderTargetView_GetResource(render_target->target->rtv, &resource); - hr = ID3D10Resource_QueryInterface(resource, &IID_IDXGISurface1, (void **)surface); - ID3D10Resource_Release(resource); + ID3D11RenderTargetView_GetResource(render_target->target->rtv, &resource); + hr = ID3D11Resource_QueryInterface(resource, &IID_IDXGISurface1, (void **)surface); + ID3D11Resource_Release(resource); if (FAILED(hr)) { *surface = NULL; @@ -2809,38 +2808,37 @@ static const struct ID2D1GdiInteropRenderTargetVtbl d2d_gdi_interop_render_targe static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, ID2D1Device *device, IUnknown *outer_unknown, const struct d2d_device_context_ops *ops) { - D3D10_SUBRESOURCE_DATA buffer_data; - D3D10_STATE_BLOCK_MASK state_mask; + D3D11_SUBRESOURCE_DATA buffer_data; struct d2d_device *device_impl; IDWriteFactory *dwrite_factory; - D3D10_RASTERIZER_DESC rs_desc; - D3D10_BUFFER_DESC buffer_desc; + D3D11_RASTERIZER_DESC rs_desc; + D3D11_BUFFER_DESC buffer_desc; unsigned int i; HRESULT hr;
- static const D3D10_INPUT_ELEMENT_DESC il_desc_outline[] = + static const D3D11_INPUT_ELEMENT_DESC il_desc_outline[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"PREV", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"NEXT", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"PREV", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NEXT", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0}, }; - static const D3D10_INPUT_ELEMENT_DESC il_desc_curve_outline[] = + static const D3D11_INPUT_ELEMENT_DESC il_desc_curve_outline[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"P", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"P", 1, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"P", 2, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"PREV", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 32, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"NEXT", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 40, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"P", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"P", 1, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"P", 2, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"PREV", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"NEXT", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 40, D3D11_INPUT_PER_VERTEX_DATA, 0}, }; - static const D3D10_INPUT_ELEMENT_DESC il_desc_triangle[] = + static const D3D11_INPUT_ELEMENT_DESC il_desc_triangle[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, }; - static const D3D10_INPUT_ELEMENT_DESC il_desc_curve[] = + static const D3D11_INPUT_ELEMENT_DESC il_desc_curve[] = { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, - {"TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 8, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0}, }; static const DWORD vs_code_outline[] = { @@ -3834,7 +3832,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, static const struct shape_info { enum d2d_shape_type shape_type; - const D3D10_INPUT_ELEMENT_DESC *il_desc; + const D3D11_INPUT_ELEMENT_DESC *il_desc; unsigned int il_element_count; const void *vs_code; size_t vs_code_size; @@ -3864,6 +3862,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, { 1.0f, -1.0f}, }; static const UINT16 indices[] = {0, 1, 2, 2, 1, 3}; + static const D3D_FEATURE_LEVEL feature_levels = D3D_FEATURE_LEVEL_11_0;
render_target->ID2D1DeviceContext_iface.lpVtbl = &d2d_device_context_vtbl; render_target->ID2D1GdiInteropRenderTarget_iface.lpVtbl = &d2d_gdi_interop_render_target_vtbl; @@ -3879,22 +3878,18 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target,
device_impl = unsafe_impl_from_ID2D1Device(device); if (FAILED(hr = IDXGIDevice_QueryInterface(device_impl->dxgi_device, - &IID_ID3D10Device, (void **)&render_target->d3d_device))) + &IID_ID3D11Device1, (void **)&render_target->d3d_device))) { WARN("Failed to get device interface, hr %#x.\n", hr); ID2D1Factory_Release(render_target->factory); return hr; }
- if (FAILED(hr = D3D10StateBlockMaskEnableAll(&state_mask))) - { - WARN("Failed to create stateblock mask, hr %#x.\n", hr); - goto err; - } - - if (FAILED(hr = D3D10CreateStateBlock(render_target->d3d_device, &state_mask, &render_target->stateblock))) + if (FAILED(hr = ID3D11Device1_CreateDeviceContextState(render_target->d3d_device, + 0, &feature_levels, 1, D3D11_SDK_VERSION, &IID_ID3D11Device1, NULL, + &render_target->d3d_state))) { - WARN("Failed to create stateblock, hr %#x.\n", hr); + WARN("Failed to create device context state, hr %#x.\n", hr); goto err; }
@@ -3902,15 +3897,15 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, { const struct shape_info *si = &shape_info[i];
- if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->d3d_device, si->il_desc, si->il_element_count, + if (FAILED(hr = ID3D11Device1_CreateInputLayout(render_target->d3d_device, si->il_desc, si->il_element_count, si->vs_code, si->vs_code_size, &render_target->shape_resources[si->shape_type].il))) { WARN("Failed to create input layout for shape type %#x, hr %#x.\n", si->shape_type, hr); goto err; }
- if (FAILED(hr = ID3D10Device_CreateVertexShader(render_target->d3d_device, si->vs_code, - si->vs_code_size, &render_target->shape_resources[si->shape_type].vs))) + if (FAILED(hr = ID3D11Device1_CreateVertexShader(render_target->d3d_device, si->vs_code, + si->vs_code_size, NULL, &render_target->shape_resources[si->shape_type].vs))) { WARN("Failed to create vertex shader for shape type %#x, hr %#x.\n", si->shape_type, hr); goto err; @@ -3918,16 +3913,16 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target,
}
- if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->d3d_device, - ps_code, sizeof(ps_code), &render_target->ps))) + if (FAILED(hr = ID3D11Device1_CreatePixelShader(render_target->d3d_device, + ps_code, sizeof(ps_code), NULL, &render_target->ps))) { WARN("Failed to create pixel shader, hr %#x.\n", hr); goto err; }
buffer_desc.ByteWidth = sizeof(indices); - buffer_desc.Usage = D3D10_USAGE_DEFAULT; - buffer_desc.BindFlags = D3D10_BIND_INDEX_BUFFER; + buffer_desc.Usage = D3D11_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0;
@@ -3935,7 +3930,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0;
- if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &render_target->ib))) { WARN("Failed to create clear index buffer, hr %#x.\n", hr); @@ -3943,19 +3938,19 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, }
buffer_desc.ByteWidth = sizeof(quad); - buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; buffer_data.pSysMem = quad;
render_target->vb_stride = sizeof(*quad); - if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->d3d_device, + if (FAILED(hr = ID3D11Device1_CreateBuffer(render_target->d3d_device, &buffer_desc, &buffer_data, &render_target->vb))) { WARN("Failed to create clear vertex buffer, hr %#x.\n", hr); goto err; }
- rs_desc.FillMode = D3D10_FILL_SOLID; - rs_desc.CullMode = D3D10_CULL_NONE; + rs_desc.FillMode = D3D11_FILL_SOLID; + rs_desc.CullMode = D3D11_CULL_NONE; rs_desc.FrontCounterClockwise = FALSE; rs_desc.DepthBias = 0; rs_desc.DepthBiasClamp = 0.0f; @@ -3964,7 +3959,7 @@ static HRESULT d2d_device_context_init(struct d2d_device_context *render_target, rs_desc.ScissorEnable = TRUE; rs_desc.MultisampleEnable = FALSE; rs_desc.AntialiasedLineEnable = FALSE; - if (FAILED(hr = ID3D10Device_CreateRasterizerState(render_target->d3d_device, &rs_desc, &render_target->rs))) + if (FAILED(hr = ID3D11Device1_CreateRasterizerState(render_target->d3d_device, &rs_desc, &render_target->rs))) { WARN("Failed to create clear rasterizer state, hr %#x.\n", hr); goto err; @@ -4003,24 +3998,24 @@ err: if (render_target->default_text_rendering_params) IDWriteRenderingParams_Release(render_target->default_text_rendering_params); if (render_target->rs) - ID3D10RasterizerState_Release(render_target->rs); + ID3D11RasterizerState_Release(render_target->rs); if (render_target->vb) - ID3D10Buffer_Release(render_target->vb); + ID3D11Buffer_Release(render_target->vb); if (render_target->ib) - ID3D10Buffer_Release(render_target->ib); + ID3D11Buffer_Release(render_target->ib); if (render_target->ps) - ID3D10PixelShader_Release(render_target->ps); + ID3D11PixelShader_Release(render_target->ps); for (i = 0; i < D2D_SHAPE_TYPE_COUNT; ++i) { if (render_target->shape_resources[i].vs) - ID3D10VertexShader_Release(render_target->shape_resources[i].vs); + ID3D11VertexShader_Release(render_target->shape_resources[i].vs); if (render_target->shape_resources[i].il) - ID3D10InputLayout_Release(render_target->shape_resources[i].il); + ID3D11InputLayout_Release(render_target->shape_resources[i].il); } - if (render_target->stateblock) - render_target->stateblock->lpVtbl->Release(render_target->stateblock); + if (render_target->d3d_state) + ID3DDeviceContextState_Release(render_target->d3d_state); if (render_target->d3d_device) - ID3D10Device_Release(render_target->d3d_device); + ID3D11Device1_Release(render_target->d3d_device); ID2D1Device_Release(render_target->device); ID2D1Factory_Release(render_target->factory); return hr; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 8d584605819..8e0899be95d 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -921,12 +921,9 @@ static ID2D1RenderTarget *create_render_target_desc(IDXGISurface *surface, hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory, NULL, (void **)&factory); ok(SUCCEEDED(hr), "Failed to create factory, hr %#x.\n", hr); hr = ID2D1Factory_CreateDxgiSurfaceRenderTarget(factory, surface, desc, &render_target); - todo_wine_if(d3d11) ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr); ID2D1Factory_Release(factory);
- if (FAILED(hr)) - return NULL; - return render_target; }
On Wed, 24 Feb 2021 at 13:14, Rémi Bernon rbernon@codeweavers.com wrote:
And ID3DDeviceContextState instead of ID3D10StateBlock.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395 Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/d2d1/bitmap.c | 83 +++++---- dlls/d2d1/brush.c | 92 +++++----- dlls/d2d1/d2d1_private.h | 36 ++-- dlls/d2d1/dc_render_target.c | 2 +- dlls/d2d1/device.c | 347 +++++++++++++++++------------------ dlls/d2d1/tests/d2d1.c | 5 +- 6 files changed, 283 insertions(+), 282 deletions(-)
Any chance this could be split a little for reviewability/bisectability? (E.g. converting the bitmap interfaces first, then the brush interfaces, etc.)
On 2/25/21 12:11 PM, Henri Verbeet wrote:
On Wed, 24 Feb 2021 at 13:14, Rémi Bernon rbernon@codeweavers.com wrote:
And ID3DDeviceContextState instead of ID3D10StateBlock.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49395 Signed-off-by: Rémi Bernon rbernon@codeweavers.com
dlls/d2d1/bitmap.c | 83 +++++---- dlls/d2d1/brush.c | 92 +++++----- dlls/d2d1/d2d1_private.h | 36 ++-- dlls/d2d1/dc_render_target.c | 2 +- dlls/d2d1/device.c | 347 +++++++++++++++++------------------ dlls/d2d1/tests/d2d1.c | 5 +- 6 files changed, 283 insertions(+), 282 deletions(-)
Any chance this could be split a little for reviewability/bisectability? (E.g. converting the bitmap interfaces first, then the brush interfaces, etc.)
I'm not sure if that'd be possible easily while keeping it correct. The D3D10 / D3D11 interfaces are supposed to be mutually exclusive and only one can be active at a time.
We don't implement that in Wine yet but for several methods (not all, I think things like resource creation can be done freely) calling the other interface methods should be no-op when one is active.
So to be correct we would have for instance, to first, query the device D3D11 interface, create the resources from it and use their D3D11 interfaces, and then query the resources D3D10 interface to use it for the binding.
Once everything has been converted, use the D3D11 interface for the device, state swap, and bindings, and drop all the interface queries.
Would it be better?