1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**************************************************************************
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2009 VMware, Inc.
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved.
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish,
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions:
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software.
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org **************************************************************************/
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_context.h"
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_memory.h"
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "util/u_inlines.h"
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "id_context.h"
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "id_objects.h"
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_destroy(struct pipe_context *_pipe)
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->destroy(pipe);
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   FREE(id_pipe);
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_draw_vbo(struct pipe_context *_pipe,
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                  const struct pipe_draw_info *info)
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->draw_vbo(pipe, info);
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_query *
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_query(struct pipe_context *_pipe,
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                      unsigned query_type)
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_query(pipe,
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             query_type);
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_destroy_query(struct pipe_context *_pipe,
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       struct pipe_query *query)
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->destroy_query(pipe,
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       query);
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_begin_query(struct pipe_context *_pipe,
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                     struct pipe_query *query)
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->begin_query(pipe,
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                     query);
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_end_query(struct pipe_context *_pipe,
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                   struct pipe_query *query)
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->end_query(pipe,
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                   query);
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic boolean
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_get_query_result(struct pipe_context *_pipe,
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                          struct pipe_query *query,
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                          boolean wait,
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                          union pipe_query_result *result)
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->get_query_result(pipe,
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 query,
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 wait,
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 result);
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_blend_state(struct pipe_context *_pipe,
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            const struct pipe_blend_state *blend)
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_blend_state(pipe,
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                   blend);
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_blend_state(struct pipe_context *_pipe,
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                          void *blend)
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->bind_blend_state(pipe,
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              blend);
137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_blend_state(struct pipe_context *_pipe,
141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            void *blend)
142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_blend_state(pipe,
147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            blend);
148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_sampler_state(struct pipe_context *_pipe,
152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              const struct pipe_sampler_state *sampler)
153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_sampler_state(pipe,
158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                     sampler);
159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_sampler_states(struct pipe_context *_pipe,
163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned shader,
164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned start,
165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned num_samplers,
166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             void **samplers)
167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* remove this when we have pipe->bind_sampler_states(..., start, ...) */
172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   assert(start == 0);
173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   switch (shader) {
175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case PIPE_SHADER_VERTEX:
176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      pipe->bind_vertex_sampler_states(pipe, num_samplers, samplers);
177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      break;
178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case PIPE_SHADER_GEOMETRY:
179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      pipe->bind_geometry_sampler_states(pipe, num_samplers, samplers);
180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      break;
181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case PIPE_SHADER_FRAGMENT:
182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers);
183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      break;
184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   default:
185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      debug_error("Unexpected shader in identity_bind_sampler_states()");
186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_fragment_sampler_states(struct pipe_context *_pipe,
191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      unsigned num_samplers,
192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      void **samplers)
193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_bind_sampler_states(_pipe, PIPE_SHADER_FRAGMENT,
195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                0, num_samplers, samplers);
196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_vertex_sampler_states(struct pipe_context *_pipe,
200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                    unsigned num_samplers,
201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                    void **samplers)
202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_bind_sampler_states(_pipe, PIPE_SHADER_VERTEX,
204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                0, num_samplers, samplers);
205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_sampler_state(struct pipe_context *_pipe,
209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              void *sampler)
210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_sampler_state(pipe,
215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              sampler);
216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_rasterizer_state(struct pipe_context *_pipe,
220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 const struct pipe_rasterizer_state *rasterizer)
221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_rasterizer_state(pipe,
226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                        rasterizer);
227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_rasterizer_state(struct pipe_context *_pipe,
231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                               void *rasterizer)
232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->bind_rasterizer_state(pipe,
237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                               rasterizer);
238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_rasterizer_state(struct pipe_context *_pipe,
242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 void *rasterizer)
243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_rasterizer_state(pipe,
248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 rasterizer);
249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_depth_stencil_alpha_state(struct pipe_context *_pipe,
253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                          const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha)
254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_depth_stencil_alpha_state(pipe,
259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                                 depth_stencil_alpha);
260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_depth_stencil_alpha_state(struct pipe_context *_pipe,
264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                        void *depth_stencil_alpha)
265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->bind_depth_stencil_alpha_state(pipe,
270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                        depth_stencil_alpha);
271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_depth_stencil_alpha_state(struct pipe_context *_pipe,
275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                          void *depth_stencil_alpha)
276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_depth_stencil_alpha_state(pipe,
281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                          depth_stencil_alpha);
282f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
283f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
284f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
285f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_fs_state(struct pipe_context *_pipe,
286f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         const struct pipe_shader_state *fs)
287f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
288f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
289f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
290f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
291f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_fs_state(pipe,
292f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                fs);
293f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
294f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
295f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
296f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_fs_state(struct pipe_context *_pipe,
297f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       void *fs)
298f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
299f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
300f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
301f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
302f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->bind_fs_state(pipe,
303f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       fs);
304f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
305f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
306f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
307f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_fs_state(struct pipe_context *_pipe,
308f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         void *fs)
309f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
310f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
311f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
312f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
313f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_fs_state(pipe,
314f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         fs);
315f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
316f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
317f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
318f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_vs_state(struct pipe_context *_pipe,
319f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         const struct pipe_shader_state *vs)
320f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
321f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
322f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
323f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
324f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_vs_state(pipe,
325f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                vs);
326f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
327f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
328f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
329f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_vs_state(struct pipe_context *_pipe,
330f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       void *vs)
331f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
332f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
333f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
334f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
335f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->bind_vs_state(pipe,
336f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                       vs);
337f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
338f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
339f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
340f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_vs_state(struct pipe_context *_pipe,
341f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         void *vs)
342f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
343f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
344f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
345f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
346f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_vs_state(pipe,
347f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         vs);
348f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
349f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
350f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
351f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
352f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_create_vertex_elements_state(struct pipe_context *_pipe,
353f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      unsigned num_elements,
354f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      const struct pipe_vertex_element *vertex_elements)
355f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
356f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
357f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
358f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
359f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return pipe->create_vertex_elements_state(pipe,
360f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                             num_elements,
361f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                             vertex_elements);
362f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
363f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
364f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
365f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_bind_vertex_elements_state(struct pipe_context *_pipe,
366f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                    void *velems)
367f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
368f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
369f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
370f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
371f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->bind_vertex_elements_state(pipe,
372f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                    velems);
373f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
374f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
375f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
376f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_delete_vertex_elements_state(struct pipe_context *_pipe,
377f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      void *velems)
378f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
379f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
380f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
381f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
382f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->delete_vertex_elements_state(pipe,
383f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      velems);
384f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
385f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
386f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
387f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_blend_color(struct pipe_context *_pipe,
388f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         const struct pipe_blend_color *blend_color)
389f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
390f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
391f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
392f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
393f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_blend_color(pipe,
394f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         blend_color);
395f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
396f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
397f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
398f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_stencil_ref(struct pipe_context *_pipe,
399f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         const struct pipe_stencil_ref *stencil_ref)
400f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
401f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
402f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
403f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
404f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_stencil_ref(pipe,
405f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         stencil_ref);
406f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
407f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
408f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
409f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_clip_state(struct pipe_context *_pipe,
410f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                        const struct pipe_clip_state *clip)
411f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
412f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
413f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
414f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
415f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_clip_state(pipe,
416f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                        clip);
417f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
418f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
419f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
420f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_sample_mask(struct pipe_context *_pipe,
421f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         unsigned sample_mask)
422f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
423f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
424f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
425f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
426f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_sample_mask(pipe,
427f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                         sample_mask);
428f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
429f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
430f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
431f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_constant_buffer(struct pipe_context *_pipe,
432f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             uint shader,
433f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             uint index,
434f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             struct pipe_constant_buffer *_cb)
435f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
436f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
437f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
438f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_constant_buffer cb;
439f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
440f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* XXX hmm? unwrap the input state */
441f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (_cb) {
442f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      cb = *_cb;
443f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      cb.buffer = identity_resource_unwrap(_cb->buffer);
444f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
445f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
446f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_constant_buffer(pipe,
447f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             shader,
448f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             index,
449f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             _cb ? &cb : NULL);
450f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
451f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
452f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
453f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_framebuffer_state(struct pipe_context *_pipe,
454f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                               const struct pipe_framebuffer_state *_state)
455f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
456f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
457f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
458f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_framebuffer_state unwrapped_state;
459f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_framebuffer_state *state = NULL;
460f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned i;
461f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
462f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* unwrap the input state */
463f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (_state) {
464f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      memcpy(&unwrapped_state, _state, sizeof(unwrapped_state));
465f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      for(i = 0; i < _state->nr_cbufs; i++)
466f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         unwrapped_state.cbufs[i] = identity_surface_unwrap(_state->cbufs[i]);
467f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      for (; i < PIPE_MAX_COLOR_BUFS; i++)
468f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         unwrapped_state.cbufs[i] = NULL;
469f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unwrapped_state.zsbuf = identity_surface_unwrap(_state->zsbuf);
470f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      state = &unwrapped_state;
471f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
472f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
473f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_framebuffer_state(pipe,
474f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                               state);
475f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
476f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
477f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
478f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_polygon_stipple(struct pipe_context *_pipe,
479f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             const struct pipe_poly_stipple *poly_stipple)
480f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
481f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
482f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
483f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
484f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_polygon_stipple(pipe,
485f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             poly_stipple);
486f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
487f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
488f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
489f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_scissor_state(struct pipe_context *_pipe,
490f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           const struct pipe_scissor_state *scissor)
491f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
492f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
493f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
494f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
495f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_scissor_state(pipe,
496f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           scissor);
497f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
498f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
499f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
500f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_viewport_state(struct pipe_context *_pipe,
501f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            const struct pipe_viewport_state *viewport)
502f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
503f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
504f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
505f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
506f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_viewport_state(pipe,
507f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            viewport);
508f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
509f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
510f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
511f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_sampler_views(struct pipe_context *_pipe,
512f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           unsigned shader,
513f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           unsigned start,
514f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           unsigned num,
515f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           struct pipe_sampler_view **_views)
516f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
517f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
518f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
519f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
520f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_sampler_view **views = NULL;
521f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned i;
522f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
523f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* remove this when we have pipe->set_sampler_views(..., start, ...) */
524f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   assert(start == 0);
525f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
526f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (_views) {
527f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      for (i = 0; i < num; i++)
528f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
529f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      for (; i < PIPE_MAX_SAMPLERS; i++)
530f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         unwrapped_views[i] = NULL;
531f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
532f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      views = unwrapped_views;
533f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
534f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
535f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   switch (shader) {
536f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case PIPE_SHADER_VERTEX:
537f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      pipe->set_vertex_sampler_views(pipe, num, views);
538f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      break;
539f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case PIPE_SHADER_GEOMETRY:
540f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      pipe->set_geometry_sampler_views(pipe, num, views);
541f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      break;
542f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   case PIPE_SHADER_FRAGMENT:
543f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      pipe->set_fragment_sampler_views(pipe, num, views);
544f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      break;
545f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   default:
546f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      debug_error("Unexpected shader in identity_set_sampler_views()");
547f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
548f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
549f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
550f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
551f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_fragment_sampler_views(struct pipe_context *_pipe,
552f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                    unsigned num,
553f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                    struct pipe_sampler_view **_views)
554f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
555f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, 0, num, _views);
556f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
557f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
558f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
559f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_vertex_sampler_views(struct pipe_context *_pipe,
560f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  unsigned num,
561f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  struct pipe_sampler_view **_views)
562f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
563f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, 0, num, _views);
564f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
565f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
566f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
567f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_vertex_buffers(struct pipe_context *_pipe,
568f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            unsigned num_buffers,
569f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            const struct pipe_vertex_buffer *_buffers)
570f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
571f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
572f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
573f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS];
574f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_vertex_buffer *buffers = NULL;
575f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned i;
576f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
577f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (num_buffers) {
578f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers));
579f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      for (i = 0; i < num_buffers; i++)
580f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org         unwrapped_buffers[i].buffer = identity_resource_unwrap(_buffers[i].buffer);
581f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      buffers = unwrapped_buffers;
582f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
583f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
584f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_vertex_buffers(pipe,
585f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            num_buffers,
586f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            buffers);
587f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
588f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
589f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
590f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_set_index_buffer(struct pipe_context *_pipe,
591f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                          const struct pipe_index_buffer *_ib)
592f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
593f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
594f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
595f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_index_buffer unwrapped_ib, *ib = NULL;
596f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
597f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (_ib) {
598f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unwrapped_ib = *_ib;
599f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unwrapped_ib.buffer = identity_resource_unwrap(_ib->buffer);
600f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      ib = &unwrapped_ib;
601f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
602f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
603f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->set_index_buffer(pipe, ib);
604f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
605f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
606f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
607f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_resource_copy_region(struct pipe_context *_pipe,
608f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              struct pipe_resource *_dst,
609f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned dst_level,
610f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned dstx,
611f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned dsty,
612f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned dstz,
613f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              struct pipe_resource *_src,
614f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned src_level,
615f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              const struct pipe_box *src_box)
616f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
617f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
618f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_resource *id_resource_dst = identity_resource(_dst);
619f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_resource *id_resource_src = identity_resource(_src);
620f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
621f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_resource *dst = id_resource_dst->resource;
622f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_resource *src = id_resource_src->resource;
623f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
624f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->resource_copy_region(pipe,
625f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              dst,
626f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              dst_level,
627f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              dstx,
628f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              dsty,
629f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              dstz,
630f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              src,
631f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              src_level,
632f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              src_box);
633f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
634f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
635f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
636f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_clear(struct pipe_context *_pipe,
637f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               unsigned buffers,
638f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               const union pipe_color_union *color,
639f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               double depth,
640f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               unsigned stencil)
641f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
642f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
643f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
644f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
645f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->clear(pipe,
646f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               buffers,
647f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               color,
648f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               depth,
649f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               stencil);
650f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
651f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
652f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
653f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_clear_render_target(struct pipe_context *_pipe,
654f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             struct pipe_surface *_dst,
655f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             const union pipe_color_union *color,
656f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned dstx, unsigned dsty,
657f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned width, unsigned height)
658f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
659f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
660f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_surface *id_surface_dst = identity_surface(_dst);
661f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
662f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_surface *dst = id_surface_dst->surface;
663f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
664f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->clear_render_target(pipe,
665f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             dst,
666f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             color,
667f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             dstx,
668f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             dsty,
669f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             width,
670f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             height);
671f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
672f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
673f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_clear_depth_stencil(struct pipe_context *_pipe,
674f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             struct pipe_surface *_dst,
675f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned clear_flags,
676f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             double depth,
677f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned stencil,
678f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned dstx, unsigned dsty,
679f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             unsigned width, unsigned height)
680f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
681f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
682f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_surface *id_surface_dst = identity_surface(_dst);
683f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
684f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_surface *dst = id_surface_dst->surface;
685f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
686f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->clear_depth_stencil(pipe,
687f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             dst,
688f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             clear_flags,
689f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             depth,
690f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             stencil,
691f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             dstx,
692f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             dsty,
693f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             width,
694f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             height);
695f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
696f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
697f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
698f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
699f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_flush(struct pipe_context *_pipe,
700f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               struct pipe_fence_handle **fence)
701f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
702f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe = identity_context(_pipe);
703f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_pipe->pipe;
704f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
705f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   pipe->flush(pipe,
706f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org               fence);
707f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
708f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
709f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_sampler_view *
710f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_create_sampler_view(struct pipe_context *_pipe,
711f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                     struct pipe_resource *_resource,
712f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                     const struct pipe_sampler_view *templ)
713f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
714f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_pipe);
715f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_resource *id_resource = identity_resource(_resource);
716f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_context->pipe;
717f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_resource *resource = id_resource->resource;
718f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_sampler_view *result;
719f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
720f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   result = pipe->create_sampler_view(pipe,
721f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      resource,
722f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      templ);
723f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
724f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (result)
725f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return identity_sampler_view_create(id_context, id_resource, result);
726f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return NULL;
727f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
728f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
729f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
730f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_sampler_view_destroy(struct pipe_context *_pipe,
731f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                      struct pipe_sampler_view *_view)
732f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
733f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_sampler_view_destroy(identity_context(_pipe),
734f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 identity_sampler_view(_view));
735f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
736f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
737f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_surface *
738f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_create_surface(struct pipe_context *_pipe,
739f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                struct pipe_resource *_resource,
740f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                const struct pipe_surface *templ)
741f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
742f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_pipe);
743f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_resource *id_resource = identity_resource(_resource);
744f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *pipe = id_context->pipe;
745f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_resource *resource = id_resource->resource;
746f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_surface *result;
747f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
748f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   result = pipe->create_surface(pipe,
749f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 resource,
750f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 templ);
751f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
752f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (result)
753f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return identity_surface_create(id_context, id_resource, result);
754f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return NULL;
755f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
756f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
757f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
758f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_surface_destroy(struct pipe_context *_pipe,
759f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                 struct pipe_surface *_surf)
760f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
761f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_surface_destroy(identity_context(_pipe),
762f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                            identity_surface(_surf));
763f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
764f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
765f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic struct pipe_transfer *
766f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_get_transfer(struct pipe_context *_context,
767f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              struct pipe_resource *_resource,
768f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned level,
769f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              unsigned usage,
770f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              const struct pipe_box *box)
771f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
772f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_context);
773f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_resource *id_resource = identity_resource(_resource);
774f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *context = id_context->pipe;
775f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_resource *resource = id_resource->resource;
776f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_transfer *result;
777f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
778f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   result = context->get_transfer(context,
779f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  resource,
780f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  level,
781f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  usage,
782f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  box);
783f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
784f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (result)
785f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return identity_transfer_create(id_context, id_resource, result);
786f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return NULL;
787f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
788f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
789f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
790f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_transfer_destroy(struct pipe_context *_pipe,
791f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  struct pipe_transfer *_transfer)
792f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
793f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   identity_transfer_destroy(identity_context(_pipe),
794f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             identity_transfer(_transfer));
795f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
796f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
797f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void *
798f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_transfer_map(struct pipe_context *_context,
799f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              struct pipe_transfer *_transfer)
800f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
801f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_context);
802f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_transfer *id_transfer = identity_transfer(_transfer);
803f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *context = id_context->pipe;
804f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_transfer *transfer = id_transfer->transfer;
805f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
806f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return context->transfer_map(context,
807f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                transfer);
808f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
809f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
810f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
811f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
812f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
813f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_transfer_flush_region(struct pipe_context *_context,
814f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       struct pipe_transfer *_transfer,
815f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       const struct pipe_box *box)
816f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
817f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_context);
818f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_transfer *id_transfer = identity_transfer(_transfer);
819f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *context = id_context->pipe;
820f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_transfer *transfer = id_transfer->transfer;
821f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
822f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   context->transfer_flush_region(context,
823f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  transfer,
824f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  box);
825f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
826f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
827f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
828f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
829f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_transfer_unmap(struct pipe_context *_context,
830f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                struct pipe_transfer *_transfer)
831f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
832f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_context);
833f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_transfer *id_transfer = identity_transfer(_transfer);
834f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *context = id_context->pipe;
835f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_transfer *transfer = id_transfer->transfer;
836f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
837f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   context->transfer_unmap(context,
838f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                           transfer);
839f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
840f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
841f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
842f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic void
843f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_transfer_inline_write(struct pipe_context *_context,
844f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       struct pipe_resource *_resource,
845f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       unsigned level,
846f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       unsigned usage,
847f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       const struct pipe_box *box,
848f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       const void *data,
849f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       unsigned stride,
850f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                       unsigned layer_stride)
851f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
852f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_context = identity_context(_context);
853f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_resource *id_resource = identity_resource(_resource);
854f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_context *context = id_context->pipe;
855f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct pipe_resource *resource = id_resource->resource;
856f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
857f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   context->transfer_inline_write(context,
858f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  resource,
859f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  level,
860f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  usage,
861f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  box,
862f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  data,
863f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  stride,
864f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                  layer_stride);
865f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
866f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
867f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
868f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_context *
869f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgidentity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
870f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
871f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct identity_context *id_pipe;
872f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   (void)identity_screen(_screen);
873f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
874f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe = CALLOC_STRUCT(identity_context);
875f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   if (!id_pipe) {
876f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      return NULL;
877f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   }
878f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
879f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.screen = _screen;
880f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.priv = pipe->priv; /* expose wrapped data */
881f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.draw = NULL;
882f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
883f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.destroy = identity_destroy;
884f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.draw_vbo = identity_draw_vbo;
885f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_query = identity_create_query;
886f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.destroy_query = identity_destroy_query;
887f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.begin_query = identity_begin_query;
888f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.end_query = identity_end_query;
889f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.get_query_result = identity_get_query_result;
890f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_blend_state = identity_create_blend_state;
891f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_blend_state = identity_bind_blend_state;
892f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_blend_state = identity_delete_blend_state;
893f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_sampler_state = identity_create_sampler_state;
894f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_fragment_sampler_states = identity_bind_fragment_sampler_states;
895f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_vertex_sampler_states = identity_bind_vertex_sampler_states;
896f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_sampler_state = identity_delete_sampler_state;
897f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_rasterizer_state = identity_create_rasterizer_state;
898f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_rasterizer_state = identity_bind_rasterizer_state;
899f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_rasterizer_state = identity_delete_rasterizer_state;
900f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_depth_stencil_alpha_state = identity_create_depth_stencil_alpha_state;
901f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_depth_stencil_alpha_state = identity_bind_depth_stencil_alpha_state;
902f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_depth_stencil_alpha_state = identity_delete_depth_stencil_alpha_state;
903f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_fs_state = identity_create_fs_state;
904f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_fs_state = identity_bind_fs_state;
905f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_fs_state = identity_delete_fs_state;
906f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_vs_state = identity_create_vs_state;
907f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_vs_state = identity_bind_vs_state;
908f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_vs_state = identity_delete_vs_state;
909f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_vertex_elements_state = identity_create_vertex_elements_state;
910f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.bind_vertex_elements_state = identity_bind_vertex_elements_state;
911f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.delete_vertex_elements_state = identity_delete_vertex_elements_state;
912f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_blend_color = identity_set_blend_color;
913f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_stencil_ref = identity_set_stencil_ref;
914f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_clip_state = identity_set_clip_state;
915f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_sample_mask = identity_set_sample_mask;
916f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_constant_buffer = identity_set_constant_buffer;
917f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_framebuffer_state = identity_set_framebuffer_state;
918f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
919f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_scissor_state = identity_set_scissor_state;
920f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_viewport_state = identity_set_viewport_state;
921f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_fragment_sampler_views = identity_set_fragment_sampler_views;
922f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_vertex_sampler_views = identity_set_vertex_sampler_views;
923f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
924f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.set_index_buffer = identity_set_index_buffer;
925f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.resource_copy_region = identity_resource_copy_region;
926f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.clear = identity_clear;
927f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.clear_render_target = identity_clear_render_target;
928f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.clear_depth_stencil = identity_clear_depth_stencil;
929f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.flush = identity_flush;
930f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_surface = identity_context_create_surface;
931f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.surface_destroy = identity_context_surface_destroy;
932f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.create_sampler_view = identity_context_create_sampler_view;
933f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.sampler_view_destroy = identity_context_sampler_view_destroy;
934f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.get_transfer = identity_context_get_transfer;
935f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.transfer_destroy = identity_context_transfer_destroy;
936f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.transfer_map = identity_context_transfer_map;
937f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.transfer_unmap = identity_context_transfer_unmap;
938f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.transfer_flush_region = identity_context_transfer_flush_region;
939f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->base.transfer_inline_write = identity_context_transfer_inline_write;
940f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
941f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   id_pipe->pipe = pipe;
942f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
943f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return &id_pipe->base;
944f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
945