mirror of
https://github.com/reactos/wine.git
synced 2025-01-22 20:04:59 +00:00
d3d10core: Create wined3d views for shader resource views.
This commit is contained in:
parent
4e73cd517a
commit
e01d207699
@ -157,6 +157,7 @@ struct d3d10_shader_resource_view
|
||||
ID3D10ShaderResourceView ID3D10ShaderResourceView_iface;
|
||||
LONG refcount;
|
||||
|
||||
struct wined3d_shader_resource_view *wined3d_view;
|
||||
D3D10_SHADER_RESOURCE_VIEW_DESC desc;
|
||||
ID3D10Resource *resource;
|
||||
ID3D10Device1 *device;
|
||||
|
@ -894,6 +894,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_Release(ID3D10ShaderRe
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
wined3d_shader_resource_view_decref(This->wined3d_view);
|
||||
ID3D10Resource_Release(This->resource);
|
||||
ID3D10Device1_Release(This->device);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
@ -1001,6 +1002,12 @@ HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view,
|
||||
view->desc = *desc;
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_shader_resource_view_create(view, &d3d10_null_wined3d_parent_ops, &view->wined3d_view)))
|
||||
{
|
||||
WARN("Failed to create wined3d shader resource view, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
view->resource = resource;
|
||||
ID3D10Resource_AddRef(resource);
|
||||
view->device = &device->ID3D10Device1_iface;
|
||||
|
@ -158,3 +158,47 @@ HRESULT CDECL wined3d_rendertarget_view_create_from_surface(struct wined3d_surfa
|
||||
|
||||
return wined3d_rendertarget_view_create(&desc, &surface->container->resource, parent, parent_ops, view);
|
||||
}
|
||||
|
||||
ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view)
|
||||
{
|
||||
ULONG refcount = InterlockedIncrement(&view->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", view, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
|
||||
{
|
||||
ULONG refcount = InterlockedDecrement(&view->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", view, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
view->parent_ops->wined3d_object_destroyed(view->parent);
|
||||
HeapFree(GetProcessHeap(), 0, view);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_shader_resource_view_create(void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
struct wined3d_shader_resource_view **view)
|
||||
{
|
||||
struct wined3d_shader_resource_view *object;
|
||||
|
||||
TRACE("parent %p, parent_ops %p, view %p.\n", parent, parent_ops, view);
|
||||
|
||||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
object->refcount = 1;
|
||||
object->parent = parent;
|
||||
object->parent_ops = parent_ops;
|
||||
|
||||
TRACE("Created shader resource view %p.\n", object);
|
||||
*view = object;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -199,6 +199,10 @@
|
||||
@ cdecl wined3d_shader_incref(ptr)
|
||||
@ cdecl wined3d_shader_set_local_constants_float(ptr long ptr long)
|
||||
|
||||
@ cdecl wined3d_shader_resource_view_create(ptr ptr ptr)
|
||||
@ cdecl wined3d_shader_resource_view_decref(ptr)
|
||||
@ cdecl wined3d_shader_resource_view_incref(ptr)
|
||||
|
||||
@ cdecl wined3d_stateblock_apply(ptr)
|
||||
@ cdecl wined3d_stateblock_capture(ptr)
|
||||
@ cdecl wined3d_stateblock_create(ptr long ptr)
|
||||
|
@ -2646,6 +2646,14 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface(
|
||||
return surface_from_resource(resource);
|
||||
}
|
||||
|
||||
struct wined3d_shader_resource_view
|
||||
{
|
||||
LONG refcount;
|
||||
|
||||
void *parent;
|
||||
const struct wined3d_parent_ops *parent_ops;
|
||||
};
|
||||
|
||||
struct wined3d_swapchain_ops
|
||||
{
|
||||
void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect,
|
||||
|
@ -1984,6 +1984,7 @@ struct wined3d_rendertarget_view;
|
||||
struct wined3d_resource;
|
||||
struct wined3d_sampler;
|
||||
struct wined3d_shader;
|
||||
struct wined3d_shader_resource_view;
|
||||
struct wined3d_stateblock;
|
||||
struct wined3d_surface;
|
||||
struct wined3d_swapchain;
|
||||
@ -2409,6 +2410,11 @@ ULONG __cdecl wined3d_shader_incref(struct wined3d_shader *shader);
|
||||
HRESULT __cdecl wined3d_shader_set_local_constants_float(struct wined3d_shader *shader,
|
||||
UINT start_idx, const float *src_data, UINT vector4f_count);
|
||||
|
||||
HRESULT __cdecl wined3d_shader_resource_view_create(void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
struct wined3d_shader_resource_view **view);
|
||||
ULONG __cdecl wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view);
|
||||
ULONG __cdecl wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view);
|
||||
|
||||
void __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock);
|
||||
void __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock);
|
||||
HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device,
|
||||
|
Loading…
x
Reference in New Issue
Block a user