Commit ee788e3e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Introduce wined3d_device_context_set_shader_resource_view().

parent e2c96d34
...@@ -2188,49 +2188,15 @@ void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_contex ...@@ -2188,49 +2188,15 @@ void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_contex
wined3d_device_context_emit_set_scissor_rects(context, rect_count, rects); wined3d_device_context_emit_set_scissor_rects(context, rect_count, rects);
} }
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) void CDECL wined3d_device_context_set_shader_resource_view(struct wined3d_device_context *context,
{ enum wined3d_shader_type type, unsigned int idx, struct wined3d_shader_resource_view *view)
TRACE("device %p, shader %p.\n", device, shader);
return wined3d_device_context_set_shader(&device->cs->c, WINED3D_SHADER_TYPE_VERTEX, shader);
}
struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device)
{
TRACE("device %p.\n", device);
return device->cs->c.state->shader[WINED3D_SHADER_TYPE_VERTEX];
}
void CDECL wined3d_device_set_constant_buffer(struct wined3d_device *device,
enum wined3d_shader_type type, UINT idx, struct wined3d_buffer *buffer)
{
TRACE("device %p, type %#x, idx %u, buffer %p.\n", device, type, idx, buffer);
return wined3d_device_context_set_constant_buffer(&device->cs->c, type, idx, buffer);
}
struct wined3d_buffer * CDECL wined3d_device_get_constant_buffer(const struct wined3d_device *device,
enum wined3d_shader_type shader_type, unsigned int idx)
{
TRACE("device %p, shader_type %#x, idx %u.\n", device, shader_type, idx);
if (idx >= MAX_CONSTANT_BUFFERS)
{
WARN("Invalid constant buffer index %u.\n", idx);
return NULL;
}
return device->cs->c.state->cb[shader_type][idx];
}
static void wined3d_device_set_shader_resource_view(struct wined3d_device *device,
enum wined3d_shader_type type, UINT idx, struct wined3d_shader_resource_view *view)
{ {
struct wined3d_state *state = context->state;
const struct wined3d_rendertarget_view *dsv; const struct wined3d_rendertarget_view *dsv;
struct wined3d_state *state = device->cs->c.state;
struct wined3d_shader_resource_view *prev; struct wined3d_shader_resource_view *prev;
TRACE("context %p, type %#x, idx %u, view %p.\n", context, type, idx, view);
if (idx >= MAX_SHADER_RESOURCE_VIEWS) if (idx >= MAX_SHADER_RESOURCE_VIEWS)
{ {
WARN("Invalid view index %u.\n", idx); WARN("Invalid view index %u.\n", idx);
...@@ -2256,7 +2222,7 @@ static void wined3d_device_set_shader_resource_view(struct wined3d_device *devic ...@@ -2256,7 +2222,7 @@ static void wined3d_device_set_shader_resource_view(struct wined3d_device *devic
} }
state->shader_resource_view[type][idx] = view; state->shader_resource_view[type][idx] = view;
wined3d_device_context_emit_set_shader_resource_view(&device->cs->c, type, idx, view); wined3d_device_context_emit_set_shader_resource_view(context, type, idx, view);
if (prev) if (prev)
{ {
wined3d_srv_bind_count_dec(prev); wined3d_srv_bind_count_dec(prev);
...@@ -2264,12 +2230,48 @@ static void wined3d_device_set_shader_resource_view(struct wined3d_device *devic ...@@ -2264,12 +2230,48 @@ static void wined3d_device_set_shader_resource_view(struct wined3d_device *devic
} }
} }
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
TRACE("device %p, shader %p.\n", device, shader);
return wined3d_device_context_set_shader(&device->cs->c, WINED3D_SHADER_TYPE_VERTEX, shader);
}
struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device)
{
TRACE("device %p.\n", device);
return device->cs->c.state->shader[WINED3D_SHADER_TYPE_VERTEX];
}
void CDECL wined3d_device_set_constant_buffer(struct wined3d_device *device,
enum wined3d_shader_type type, UINT idx, struct wined3d_buffer *buffer)
{
TRACE("device %p, type %#x, idx %u, buffer %p.\n", device, type, idx, buffer);
return wined3d_device_context_set_constant_buffer(&device->cs->c, type, idx, buffer);
}
struct wined3d_buffer * CDECL wined3d_device_get_constant_buffer(const struct wined3d_device *device,
enum wined3d_shader_type shader_type, unsigned int idx)
{
TRACE("device %p, shader_type %#x, idx %u.\n", device, shader_type, idx);
if (idx >= MAX_CONSTANT_BUFFERS)
{
WARN("Invalid constant buffer index %u.\n", idx);
return NULL;
}
return device->cs->c.state->cb[shader_type][idx];
}
void CDECL wined3d_device_set_vs_resource_view(struct wined3d_device *device, void CDECL wined3d_device_set_vs_resource_view(struct wined3d_device *device,
UINT idx, struct wined3d_shader_resource_view *view) UINT idx, struct wined3d_shader_resource_view *view)
{ {
TRACE("device %p, idx %u, view %p.\n", device, idx, view); TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_VERTEX, idx, view); wined3d_device_context_set_shader_resource_view(&device->cs->c, WINED3D_SHADER_TYPE_VERTEX, idx, view);
} }
static struct wined3d_shader_resource_view *wined3d_device_get_shader_resource_view( static struct wined3d_shader_resource_view *wined3d_device_get_shader_resource_view(
...@@ -2415,7 +2417,7 @@ void CDECL wined3d_device_set_ps_resource_view(struct wined3d_device *device, ...@@ -2415,7 +2417,7 @@ void CDECL wined3d_device_set_ps_resource_view(struct wined3d_device *device,
{ {
TRACE("device %p, idx %u, view %p.\n", device, idx, view); TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_PIXEL, idx, view); wined3d_device_context_set_shader_resource_view(&device->cs->c, WINED3D_SHADER_TYPE_PIXEL, idx, view);
} }
struct wined3d_shader_resource_view * CDECL wined3d_device_get_ps_resource_view(const struct wined3d_device *device, struct wined3d_shader_resource_view * CDECL wined3d_device_get_ps_resource_view(const struct wined3d_device *device,
...@@ -2513,7 +2515,7 @@ void CDECL wined3d_device_set_hs_resource_view(struct wined3d_device *device, ...@@ -2513,7 +2515,7 @@ void CDECL wined3d_device_set_hs_resource_view(struct wined3d_device *device,
{ {
TRACE("device %p, idx %u, view %p.\n", device, idx, view); TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_HULL, idx, view); wined3d_device_context_set_shader_resource_view(&device->cs->c, WINED3D_SHADER_TYPE_HULL, idx, view);
} }
struct wined3d_shader_resource_view * CDECL wined3d_device_get_hs_resource_view(const struct wined3d_device *device, struct wined3d_shader_resource_view * CDECL wined3d_device_get_hs_resource_view(const struct wined3d_device *device,
...@@ -2558,7 +2560,7 @@ void CDECL wined3d_device_set_ds_resource_view(struct wined3d_device *device, ...@@ -2558,7 +2560,7 @@ void CDECL wined3d_device_set_ds_resource_view(struct wined3d_device *device,
{ {
TRACE("device %p, idx %u, view %p.\n", device, idx, view); TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_DOMAIN, idx, view); wined3d_device_context_set_shader_resource_view(&device->cs->c, WINED3D_SHADER_TYPE_DOMAIN, idx, view);
} }
struct wined3d_shader_resource_view * CDECL wined3d_device_get_ds_resource_view(const struct wined3d_device *device, struct wined3d_shader_resource_view * CDECL wined3d_device_get_ds_resource_view(const struct wined3d_device *device,
...@@ -2603,7 +2605,7 @@ void CDECL wined3d_device_set_gs_resource_view(struct wined3d_device *device, ...@@ -2603,7 +2605,7 @@ void CDECL wined3d_device_set_gs_resource_view(struct wined3d_device *device,
{ {
TRACE("device %p, idx %u, view %p.\n", device, idx, view); TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_GEOMETRY, idx, view); wined3d_device_context_set_shader_resource_view(&device->cs->c, WINED3D_SHADER_TYPE_GEOMETRY, idx, view);
} }
struct wined3d_shader_resource_view * CDECL wined3d_device_get_gs_resource_view(const struct wined3d_device *device, struct wined3d_shader_resource_view * CDECL wined3d_device_get_gs_resource_view(const struct wined3d_device *device,
...@@ -2647,7 +2649,7 @@ void CDECL wined3d_device_set_cs_resource_view(struct wined3d_device *device, ...@@ -2647,7 +2649,7 @@ void CDECL wined3d_device_set_cs_resource_view(struct wined3d_device *device,
{ {
TRACE("device %p, idx %u, view %p.\n", device, idx, view); TRACE("device %p, idx %u, view %p.\n", device, idx, view);
wined3d_device_set_shader_resource_view(device, WINED3D_SHADER_TYPE_COMPUTE, idx, view); wined3d_device_context_set_shader_resource_view(&device->cs->c, WINED3D_SHADER_TYPE_COMPUTE, idx, view);
} }
struct wined3d_shader_resource_view * CDECL wined3d_device_get_cs_resource_view(const struct wined3d_device *device, struct wined3d_shader_resource_view * CDECL wined3d_device_get_cs_resource_view(const struct wined3d_device *device,
...@@ -5183,7 +5185,7 @@ static void wined3d_unbind_srv_for_rtv(struct wined3d_device *device, ...@@ -5183,7 +5185,7 @@ static void wined3d_unbind_srv_for_rtv(struct wined3d_device *device,
if ((srv = state->shader_resource_view[i][j]) && srv->resource == resource if ((srv = state->shader_resource_view[i][j]) && srv->resource == resource
&& ((!dsv && wined3d_is_srv_rtv_bound(srv)) && ((!dsv && wined3d_is_srv_rtv_bound(srv))
|| (dsv && wined3d_dsv_srv_conflict(view, srv->format)))) || (dsv && wined3d_dsv_srv_conflict(view, srv->format))))
wined3d_device_set_shader_resource_view(device, i, j, NULL); wined3d_device_context_set_shader_resource_view(&device->cs->c, i, j, NULL);
} }
} }
......
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
@ cdecl wined3d_device_context_set_rasterizer_state(ptr ptr) @ cdecl wined3d_device_context_set_rasterizer_state(ptr ptr)
@ cdecl wined3d_device_context_set_scissor_rects(ptr long ptr) @ cdecl wined3d_device_context_set_scissor_rects(ptr long ptr)
@ cdecl wined3d_device_context_set_shader(ptr long ptr) @ cdecl wined3d_device_context_set_shader(ptr long ptr)
@ cdecl wined3d_device_context_set_shader_resource_view(ptr long long ptr)
@ cdecl wined3d_device_context_set_viewports(ptr long ptr) @ cdecl wined3d_device_context_set_viewports(ptr long ptr)
@ cdecl wined3d_output_find_closest_matching_mode(ptr ptr) @ cdecl wined3d_output_find_closest_matching_mode(ptr ptr)
......
...@@ -2560,6 +2560,8 @@ void __cdecl wined3d_device_context_set_scissor_rects(struct wined3d_device_cont ...@@ -2560,6 +2560,8 @@ void __cdecl wined3d_device_context_set_scissor_rects(struct wined3d_device_cont
const RECT *rects); const RECT *rects);
void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *context, void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *context,
enum wined3d_shader_type type, struct wined3d_shader *shader); enum wined3d_shader_type type, struct wined3d_shader *shader);
void __cdecl wined3d_device_context_set_shader_resource_view(struct wined3d_device_context *context,
enum wined3d_shader_type type, unsigned int idx, struct wined3d_shader_resource_view *view);
void __cdecl wined3d_device_context_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count, void __cdecl wined3d_device_context_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count,
const struct wined3d_viewport *viewports); const struct wined3d_viewport *viewports);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment