d3d11: Implement d3d11_rendertarget_view_GetDesc().
This commit is contained in:
parent
99bb367d52
commit
818051c50f
|
@ -179,13 +179,13 @@ struct d3d_rendertarget_view
|
|||
|
||||
struct wined3d_private_store private_store;
|
||||
struct wined3d_rendertarget_view *wined3d_view;
|
||||
D3D10_RENDER_TARGET_VIEW_DESC desc;
|
||||
D3D11_RENDER_TARGET_VIEW_DESC desc;
|
||||
ID3D11Resource *resource;
|
||||
ID3D10Device1 *device;
|
||||
};
|
||||
|
||||
HRESULT d3d_rendertarget_view_init(struct d3d_rendertarget_view *view, struct d3d_device *device,
|
||||
ID3D11Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc) DECLSPEC_HIDDEN;
|
||||
ID3D11Resource *resource, const D3D11_RENDER_TARGET_VIEW_DESC *desc) DECLSPEC_HIDDEN;
|
||||
struct d3d_rendertarget_view *unsafe_impl_from_ID3D10RenderTargetView(ID3D10RenderTargetView *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
/* ID3D10ShaderResourceView */
|
||||
|
|
|
@ -2138,7 +2138,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Devic
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(hr = d3d_rendertarget_view_init(object, device, d3d11_resource, desc)))
|
||||
if (FAILED(hr = d3d_rendertarget_view_init(object, device, d3d11_resource,
|
||||
(const D3D11_RENDER_TARGET_VIEW_DESC *)desc)))
|
||||
{
|
||||
WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
|
|
|
@ -121,7 +121,7 @@ static HRESULT set_dsdesc_from_resource(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3
|
|||
}
|
||||
}
|
||||
|
||||
static HRESULT set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D11Resource *resource)
|
||||
static HRESULT set_rtdesc_from_resource(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Resource *resource)
|
||||
{
|
||||
D3D11_RESOURCE_DIMENSION dimension;
|
||||
HRESULT hr;
|
||||
|
@ -132,28 +132,28 @@ static HRESULT set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3
|
|||
{
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
|
||||
{
|
||||
ID3D10Texture1D *texture;
|
||||
D3D10_TEXTURE1D_DESC texture_desc;
|
||||
ID3D11Texture1D *texture;
|
||||
D3D11_TEXTURE1D_DESC texture_desc;
|
||||
|
||||
hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D10Texture1D, (void **)&texture);
|
||||
hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture1D, (void **)&texture);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Resource of type TEXTURE1D doesn't implement ID3D10Texture1D?\n");
|
||||
ERR("Resource of type TEXTURE1D doesn't implement ID3D11Texture1D?\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
ID3D10Texture1D_GetDesc(texture, &texture_desc);
|
||||
ID3D10Texture1D_Release(texture);
|
||||
ID3D11Texture1D_GetDesc(texture, &texture_desc);
|
||||
ID3D11Texture1D_Release(texture);
|
||||
|
||||
desc->Format = texture_desc.Format;
|
||||
if (texture_desc.ArraySize == 1)
|
||||
{
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1D;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1D;
|
||||
desc->u.Texture1D.MipSlice = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE1DARRAY;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1DARRAY;
|
||||
desc->u.Texture1DArray.MipSlice = 0;
|
||||
desc->u.Texture1DArray.FirstArraySlice = 0;
|
||||
desc->u.Texture1DArray.ArraySize = 1;
|
||||
|
@ -164,44 +164,44 @@ static HRESULT set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3
|
|||
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
|
||||
{
|
||||
ID3D10Texture2D *texture;
|
||||
D3D10_TEXTURE2D_DESC texture_desc;
|
||||
ID3D11Texture2D *texture;
|
||||
D3D11_TEXTURE2D_DESC texture_desc;
|
||||
|
||||
hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture);
|
||||
hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture2D, (void **)&texture);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Resource of type TEXTURE2D doesn't implement ID3D10Texture2D?\n");
|
||||
ERR("Resource of type TEXTURE2D doesn't implement ID3D11Texture2D?\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
ID3D10Texture2D_GetDesc(texture, &texture_desc);
|
||||
ID3D10Texture2D_Release(texture);
|
||||
ID3D11Texture2D_GetDesc(texture, &texture_desc);
|
||||
ID3D11Texture2D_Release(texture);
|
||||
|
||||
desc->Format = texture_desc.Format;
|
||||
if (texture_desc.ArraySize == 1)
|
||||
{
|
||||
if (texture_desc.SampleDesc.Count == 1)
|
||||
{
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
desc->u.Texture2D.MipSlice = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMS;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (texture_desc.SampleDesc.Count == 1)
|
||||
{
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DARRAY;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
|
||||
desc->u.Texture2DArray.MipSlice = 0;
|
||||
desc->u.Texture2DArray.FirstArraySlice = 0;
|
||||
desc->u.Texture2DArray.ArraySize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY;
|
||||
desc->u.Texture2DMSArray.FirstArraySlice = 0;
|
||||
desc->u.Texture2DMSArray.ArraySize = 1;
|
||||
}
|
||||
|
@ -212,21 +212,21 @@ static HRESULT set_rtdesc_from_resource(D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3
|
|||
|
||||
case D3D11_RESOURCE_DIMENSION_TEXTURE3D:
|
||||
{
|
||||
ID3D10Texture3D *texture;
|
||||
D3D10_TEXTURE3D_DESC texture_desc;
|
||||
ID3D11Texture3D *texture;
|
||||
D3D11_TEXTURE3D_DESC texture_desc;
|
||||
|
||||
hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture);
|
||||
hr = ID3D11Resource_QueryInterface(resource, &IID_ID3D11Texture3D, (void **)&texture);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Resource of type TEXTURE3D doesn't implement ID3D10Texture3D?\n");
|
||||
ERR("Resource of type TEXTURE3D doesn't implement ID3D11Texture3D?\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
ID3D10Texture3D_GetDesc(texture, &texture_desc);
|
||||
ID3D10Texture3D_Release(texture);
|
||||
ID3D11Texture3D_GetDesc(texture, &texture_desc);
|
||||
ID3D11Texture3D_Release(texture);
|
||||
|
||||
desc->Format = texture_desc.Format;
|
||||
desc->ViewDimension = D3D10_RTV_DIMENSION_TEXTURE3D;
|
||||
desc->ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
|
||||
desc->u.Texture3D.MipSlice = 0;
|
||||
desc->u.Texture3D.FirstWSlice = 0;
|
||||
desc->u.Texture3D.WSize = 1;
|
||||
|
@ -886,7 +886,11 @@ static void STDMETHODCALLTYPE d3d11_rendertarget_view_GetResource(ID3D11RenderTa
|
|||
static void STDMETHODCALLTYPE d3d11_rendertarget_view_GetDesc(ID3D11RenderTargetView *iface,
|
||||
D3D11_RENDER_TARGET_VIEW_DESC *desc)
|
||||
{
|
||||
FIXME("iface %p, desc %p stub!\n", iface, desc);
|
||||
struct d3d_rendertarget_view *view = impl_from_ID3D11RenderTargetView(iface);
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
*desc = view->desc;
|
||||
}
|
||||
|
||||
static const struct ID3D11RenderTargetViewVtbl d3d11_rendertarget_view_vtbl =
|
||||
|
@ -1004,11 +1008,11 @@ static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTa
|
|||
static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetDesc(ID3D10RenderTargetView *iface,
|
||||
D3D10_RENDER_TARGET_VIEW_DESC *desc)
|
||||
{
|
||||
struct d3d_rendertarget_view *This = impl_from_ID3D10RenderTargetView(iface);
|
||||
struct d3d_rendertarget_view *view = impl_from_ID3D10RenderTargetView(iface);
|
||||
|
||||
TRACE("iface %p, desc %p\n", iface, desc);
|
||||
|
||||
*desc = This->desc;
|
||||
memcpy(desc, &view->desc, sizeof(*desc));
|
||||
}
|
||||
|
||||
static const struct ID3D10RenderTargetViewVtbl d3d10_rendertarget_view_vtbl =
|
||||
|
@ -1028,55 +1032,55 @@ static const struct ID3D10RenderTargetViewVtbl d3d10_rendertarget_view_vtbl =
|
|||
d3d10_rendertarget_view_GetDesc,
|
||||
};
|
||||
|
||||
static void wined3d_rendertarget_view_desc_from_d3d10core(struct wined3d_rendertarget_view_desc *wined3d_desc,
|
||||
const D3D10_RENDER_TARGET_VIEW_DESC *desc)
|
||||
static void wined3d_rendertarget_view_desc_from_d3d11(struct wined3d_rendertarget_view_desc *wined3d_desc,
|
||||
const D3D11_RENDER_TARGET_VIEW_DESC *desc)
|
||||
{
|
||||
wined3d_desc->format_id = wined3dformat_from_dxgi_format(desc->Format);
|
||||
|
||||
switch (desc->ViewDimension)
|
||||
{
|
||||
case D3D10_RTV_DIMENSION_BUFFER:
|
||||
wined3d_desc->u.buffer.start_idx = desc->u.Buffer.ElementOffset;
|
||||
wined3d_desc->u.buffer.count = desc->u.Buffer.ElementWidth;
|
||||
case D3D11_RTV_DIMENSION_BUFFER:
|
||||
wined3d_desc->u.buffer.start_idx = desc->u.Buffer.u1.FirstElement;
|
||||
wined3d_desc->u.buffer.count = desc->u.Buffer.u2.NumElements;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE1D:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE1D:
|
||||
wined3d_desc->u.texture.level_idx = desc->u.Texture1D.MipSlice;
|
||||
wined3d_desc->u.texture.layer_idx = 0;
|
||||
wined3d_desc->u.texture.layer_count = 1;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE1DARRAY:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
|
||||
wined3d_desc->u.texture.level_idx = desc->u.Texture1DArray.MipSlice;
|
||||
wined3d_desc->u.texture.layer_idx = desc->u.Texture1DArray.FirstArraySlice;
|
||||
wined3d_desc->u.texture.layer_count = desc->u.Texture1DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE2D:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2D:
|
||||
wined3d_desc->u.texture.level_idx = desc->u.Texture2D.MipSlice;
|
||||
wined3d_desc->u.texture.layer_idx = 0;
|
||||
wined3d_desc->u.texture.layer_count = 1;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE2DARRAY:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
|
||||
wined3d_desc->u.texture.level_idx = desc->u.Texture2DArray.MipSlice;
|
||||
wined3d_desc->u.texture.layer_idx = desc->u.Texture2DArray.FirstArraySlice;
|
||||
wined3d_desc->u.texture.layer_count = desc->u.Texture2DArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE2DMS:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2DMS:
|
||||
wined3d_desc->u.texture.level_idx = 0;
|
||||
wined3d_desc->u.texture.layer_idx = 0;
|
||||
wined3d_desc->u.texture.layer_count = 1;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
|
||||
wined3d_desc->u.texture.level_idx = 0;
|
||||
wined3d_desc->u.texture.layer_idx = desc->u.Texture2DMSArray.FirstArraySlice;
|
||||
wined3d_desc->u.texture.layer_count = desc->u.Texture2DMSArray.ArraySize;
|
||||
break;
|
||||
|
||||
case D3D10_RTV_DIMENSION_TEXTURE3D:
|
||||
case D3D11_RTV_DIMENSION_TEXTURE3D:
|
||||
wined3d_desc->u.texture.level_idx = desc->u.Texture3D.MipSlice;
|
||||
wined3d_desc->u.texture.layer_idx = desc->u.Texture3D.FirstWSlice;
|
||||
wined3d_desc->u.texture.layer_count = desc->u.Texture3D.WSize;
|
||||
|
@ -1092,7 +1096,7 @@ static void wined3d_rendertarget_view_desc_from_d3d10core(struct wined3d_rendert
|
|||
}
|
||||
|
||||
HRESULT d3d_rendertarget_view_init(struct d3d_rendertarget_view *view, struct d3d_device *device,
|
||||
ID3D11Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc)
|
||||
ID3D11Resource *resource, const D3D11_RENDER_TARGET_VIEW_DESC *desc)
|
||||
{
|
||||
struct wined3d_rendertarget_view_desc wined3d_desc;
|
||||
struct wined3d_resource *wined3d_resource;
|
||||
|
@ -1120,7 +1124,7 @@ HRESULT d3d_rendertarget_view_init(struct d3d_rendertarget_view *view, struct d3
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
wined3d_rendertarget_view_desc_from_d3d10core(&wined3d_desc, &view->desc);
|
||||
wined3d_rendertarget_view_desc_from_d3d11(&wined3d_desc, &view->desc);
|
||||
if (FAILED(hr = wined3d_rendertarget_view_create(&wined3d_desc, wined3d_resource,
|
||||
view, &d3d10_null_wined3d_parent_ops, &view->wined3d_view)))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue