1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2010 Red Hat Inc.
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"),
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * on the rights to use, copy, modify, merge, publish, distribute, sub
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * license, and/or sell copies of the Software, and to permit persons to whom
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the Software is furnished to do so, subject to the following conditions:
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the next
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * paragraph) shall be included in all copies or substantial portions of the
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software.
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * USE OR OTHER DEALINGS IN THE SOFTWARE.
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <stdio.h>
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <errno.h>
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_defines.h"
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_state.h"
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_context.h"
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_screen.h"
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_memory.h"
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_inlines.h"
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_transfer.h"
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_blend_color(struct pipe_context *ctx,
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_blend_color *state)
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *noop_create_blend_state(struct pipe_context *ctx,
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_blend_state *state)
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_blend_state *nstate = CALLOC_STRUCT(pipe_blend_state);
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (nstate == NULL) {
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	}
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	*nstate = *state;
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return nstate;
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *noop_create_dsa_state(struct pipe_context *ctx,
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org				   const struct pipe_depth_stencil_alpha_state *state)
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_depth_stencil_alpha_state *nstate = CALLOC_STRUCT(pipe_depth_stencil_alpha_state);
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (nstate == NULL) {
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	}
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	*nstate = *state;
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return nstate;
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *noop_create_rs_state(struct pipe_context *ctx,
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_rasterizer_state *state)
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_rasterizer_state *nstate = CALLOC_STRUCT(pipe_rasterizer_state);
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (nstate == NULL) {
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	}
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	*nstate = *state;
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return nstate;
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *noop_create_sampler_state(struct pipe_context *ctx,
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_sampler_state *state)
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_sampler_state *nstate = CALLOC_STRUCT(pipe_sampler_state);
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (nstate == NULL) {
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	}
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	*nstate = *state;
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return nstate;
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_sampler_view *noop_create_sampler_view(struct pipe_context *ctx,
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org							struct pipe_resource *texture,
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org							const struct pipe_sampler_view *state)
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_sampler_view *sampler_view = CALLOC_STRUCT(pipe_sampler_view);
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (sampler_view == NULL)
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	/* initialize base object */
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	pipe_resource_reference(&sampler_view->texture, texture);
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	pipe_reference_init(&sampler_view->reference, 1);
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	sampler_view->context = ctx;
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return sampler_view;
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org						struct pipe_resource *texture,
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org						const struct pipe_surface *surf_tmpl)
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (surface == NULL)
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	pipe_reference_init(&surface->reference, 1);
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	pipe_resource_reference(&surface->texture, texture);
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->context = ctx;
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->format = surf_tmpl->format;
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->width = texture->width0;
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->height = texture->height0;
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->usage = surf_tmpl->usage;
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->texture = texture;
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	surface->u.tex.level = surf_tmpl->u.tex.level;
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return surface;
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					struct pipe_sampler_view **views)
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					struct pipe_sampler_view **views)
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_bind_sampler(struct pipe_context *ctx, unsigned count, void **states)
139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_clip_state(struct pipe_context *ctx,
143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org				const struct pipe_clip_state *state)
144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_polygon_stipple(struct pipe_context *ctx,
148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					 const struct pipe_poly_stipple *state)
149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_scissor_state(struct pipe_context *ctx,
157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_scissor_state *state)
158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_stencil_ref(struct pipe_context *ctx,
162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org				const struct pipe_stencil_ref *state)
163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_viewport_state(struct pipe_context *ctx,
167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_viewport_state *state)
168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_framebuffer_state(struct pipe_context *ctx,
172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_framebuffer_state *state)
173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_constant_buffer(struct pipe_context *ctx,
177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					uint shader, uint index,
178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					struct pipe_constant_buffer *cb)
179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_sampler_view_destroy(struct pipe_context *ctx,
184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org				struct pipe_sampler_view *state)
185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	pipe_resource_reference(&state->texture, NULL);
187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	FREE(state);
188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_surface_destroy(struct pipe_context *ctx,
192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org				 struct pipe_surface *surface)
193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	pipe_resource_reference(&surface->texture, NULL);
195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	FREE(surface);
196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_bind_state(struct pipe_context *ctx, void *state)
199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_delete_state(struct pipe_context *ctx, void *state)
203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	FREE(state);
205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_delete_vertex_element(struct pipe_context *ctx, void *state)
208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	FREE(state);
210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_index_buffer(struct pipe_context *ctx,
214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_index_buffer *ib)
215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_vertex_buffer *buffers)
220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *noop_create_vertex_elements(struct pipe_context *ctx,
224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					unsigned count,
225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_vertex_element *state)
226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_vertex_element *nstate = CALLOC_STRUCT(pipe_vertex_element);
228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (nstate == NULL) {
230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	}
232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	*nstate = *state;
233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return nstate;
234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *noop_create_shader_state(struct pipe_context *ctx,
237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org					const struct pipe_shader_state *state)
238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	struct pipe_shader_state *nstate = CALLOC_STRUCT(pipe_shader_state);
240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	if (nstate == NULL) {
242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org		return NULL;
243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	}
244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	*nstate = *state;
245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	return nstate;
246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_stream_output_target *noop_create_stream_output_target(
249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      struct pipe_context *ctx,
250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      struct pipe_resource *res,
251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unsigned buffer_offset,
252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unsigned buffer_size)
253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_stream_output_target *t = CALLOC_STRUCT(pipe_stream_output_target);
255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (!t)
256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return NULL;
257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe_reference_init(&t->reference, 1);
259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe_resource_reference(&t->buffer, res);
260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   t->buffer_offset = buffer_offset;
261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   t->buffer_size = buffer_size;
262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return t;
263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_stream_output_target_destroy(struct pipe_context *ctx,
266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      struct pipe_stream_output_target *t)
267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe_resource_reference(&t->buffer, NULL);
269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   FREE(t);
270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void noop_set_stream_output_targets(struct pipe_context *ctx,
273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           unsigned num_targets,
274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           struct pipe_stream_output_target **targets,
275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           unsigned append_bitmask)
276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid noop_init_state_functions(struct pipe_context *ctx);
280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid noop_init_state_functions(struct pipe_context *ctx)
282f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
283f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_blend_state = noop_create_blend_state;
284f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_depth_stencil_alpha_state = noop_create_dsa_state;
285f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_fs_state = noop_create_shader_state;
286f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_rasterizer_state = noop_create_rs_state;
287f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_sampler_state = noop_create_sampler_state;
288f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_sampler_view = noop_create_sampler_view;
289f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_surface = noop_create_surface;
290f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_vertex_elements_state = noop_create_vertex_elements;
291f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_vs_state = noop_create_shader_state;
292f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_blend_state = noop_bind_state;
293f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_depth_stencil_alpha_state = noop_bind_state;
294f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_fragment_sampler_states = noop_bind_sampler;
295f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_fs_state = noop_bind_state;
296f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_rasterizer_state = noop_bind_state;
297f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_vertex_elements_state = noop_bind_state;
298f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_vertex_sampler_states = noop_bind_sampler;
299f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->bind_vs_state = noop_bind_state;
300f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_blend_state = noop_delete_state;
301f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_depth_stencil_alpha_state = noop_delete_state;
302f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_fs_state = noop_delete_state;
303f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_rasterizer_state = noop_delete_state;
304f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_sampler_state = noop_delete_state;
305f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_vertex_elements_state = noop_delete_vertex_element;
306f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->delete_vs_state = noop_delete_state;
307f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_blend_color = noop_set_blend_color;
308f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_clip_state = noop_set_clip_state;
309f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_constant_buffer = noop_set_constant_buffer;
310f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_fragment_sampler_views = noop_set_ps_sampler_view;
311f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_framebuffer_state = noop_set_framebuffer_state;
312f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_polygon_stipple = noop_set_polygon_stipple;
313f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_sample_mask = noop_set_sample_mask;
314f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_scissor_state = noop_set_scissor_state;
315f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_stencil_ref = noop_set_stencil_ref;
316f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_vertex_buffers = noop_set_vertex_buffers;
317f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_index_buffer = noop_set_index_buffer;
318f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_vertex_sampler_views = noop_set_vs_sampler_view;
319f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_viewport_state = noop_set_viewport_state;
320f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->sampler_view_destroy = noop_sampler_view_destroy;
321f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->surface_destroy = noop_surface_destroy;
322f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->draw_vbo = noop_draw_vbo;
323f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->create_stream_output_target = noop_create_stream_output_target;
324f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->stream_output_target_destroy = noop_stream_output_target_destroy;
325f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org	ctx->set_stream_output_targets = noop_set_stream_output_targets;
326f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
327