Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4358 | Serge | 1 | /************************************************************************** |
2 | * |
||
3 | * Copyright 2009 VMware, Inc. |
||
4 | * All Rights Reserved. |
||
5 | * |
||
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
||
7 | * copy of this software and associated documentation files (the |
||
8 | * "Software"), to deal in the Software without restriction, including |
||
9 | * without limitation the rights to use, copy, modify, merge, publish, |
||
10 | * distribute, sub license, and/or sell copies of the Software, and to |
||
11 | * permit persons to whom the Software is furnished to do so, subject to |
||
12 | * the following conditions: |
||
13 | * |
||
14 | * The above copyright notice and this permission notice (including the |
||
15 | * next paragraph) shall be included in all copies or substantial portions |
||
16 | * of the Software. |
||
17 | * |
||
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
||
19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
||
21 | * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR |
||
22 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
||
23 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
||
24 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
25 | * |
||
26 | **************************************************************************/ |
||
27 | |||
28 | |||
29 | #include "pipe/p_context.h" |
||
30 | |||
31 | #include "util/u_format.h" |
||
32 | #include "util/u_memory.h" |
||
33 | #include "util/u_inlines.h" |
||
34 | |||
35 | #include "glhd_context.h" |
||
36 | #include "glhd_objects.h" |
||
37 | |||
38 | |||
39 | static void |
||
40 | galahad_context_destroy(struct pipe_context *_pipe) |
||
41 | { |
||
42 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
43 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
44 | |||
45 | pipe->destroy(pipe); |
||
46 | |||
47 | FREE(glhd_pipe); |
||
48 | } |
||
49 | |||
50 | static void |
||
51 | galahad_context_draw_vbo(struct pipe_context *_pipe, |
||
52 | const struct pipe_draw_info *info) |
||
53 | { |
||
54 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
55 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
56 | |||
57 | /* XXX we should check that all bound resources are unmapped |
||
58 | * before drawing. |
||
59 | */ |
||
60 | |||
61 | pipe->draw_vbo(pipe, info); |
||
62 | } |
||
63 | |||
64 | static struct pipe_query * |
||
65 | galahad_context_create_query(struct pipe_context *_pipe, |
||
66 | unsigned query_type) |
||
67 | { |
||
68 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
69 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
70 | |||
71 | if (query_type == PIPE_QUERY_OCCLUSION_COUNTER && |
||
72 | !pipe->screen->get_param(pipe->screen, PIPE_CAP_OCCLUSION_QUERY)) { |
||
73 | glhd_error("Occlusion query requested but not supported"); |
||
74 | } |
||
75 | |||
76 | if (query_type == PIPE_QUERY_TIME_ELAPSED && |
||
77 | !pipe->screen->get_param(pipe->screen, PIPE_CAP_QUERY_TIME_ELAPSED)) { |
||
78 | glhd_error("Timer query requested but not supported"); |
||
79 | } |
||
80 | |||
81 | return pipe->create_query(pipe, |
||
82 | query_type); |
||
83 | } |
||
84 | |||
85 | static void |
||
86 | galahad_context_destroy_query(struct pipe_context *_pipe, |
||
87 | struct pipe_query *query) |
||
88 | { |
||
89 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
90 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
91 | |||
92 | pipe->destroy_query(pipe, |
||
93 | query); |
||
94 | } |
||
95 | |||
96 | static void |
||
97 | galahad_context_begin_query(struct pipe_context *_pipe, |
||
98 | struct pipe_query *query) |
||
99 | { |
||
100 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
101 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
102 | |||
103 | pipe->begin_query(pipe, |
||
104 | query); |
||
105 | } |
||
106 | |||
107 | static void |
||
108 | galahad_context_end_query(struct pipe_context *_pipe, |
||
109 | struct pipe_query *query) |
||
110 | { |
||
111 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
112 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
113 | |||
114 | pipe->end_query(pipe, |
||
115 | query); |
||
116 | } |
||
117 | |||
118 | static boolean |
||
119 | galahad_context_get_query_result(struct pipe_context *_pipe, |
||
120 | struct pipe_query *query, |
||
121 | boolean wait, |
||
122 | union pipe_query_result *result) |
||
123 | { |
||
124 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
125 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
126 | |||
127 | return pipe->get_query_result(pipe, |
||
128 | query, |
||
129 | wait, |
||
130 | result); |
||
131 | } |
||
132 | |||
133 | static void * |
||
134 | galahad_context_create_blend_state(struct pipe_context *_pipe, |
||
135 | const struct pipe_blend_state *blend) |
||
136 | { |
||
137 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
138 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
139 | |||
140 | if (blend->logicop_enable) { |
||
141 | if (blend->rt[0].blend_enable) { |
||
142 | glhd_warn("Blending enabled for render target 0, but logicops " |
||
143 | "are enabled"); |
||
144 | } |
||
145 | } |
||
146 | |||
147 | return pipe->create_blend_state(pipe, |
||
148 | blend); |
||
149 | } |
||
150 | |||
151 | static void |
||
152 | galahad_context_bind_blend_state(struct pipe_context *_pipe, |
||
153 | void *blend) |
||
154 | { |
||
155 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
156 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
157 | |||
158 | pipe->bind_blend_state(pipe, |
||
159 | blend); |
||
160 | } |
||
161 | |||
162 | static void |
||
163 | galahad_context_delete_blend_state(struct pipe_context *_pipe, |
||
164 | void *blend) |
||
165 | { |
||
166 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
167 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
168 | |||
169 | pipe->delete_blend_state(pipe, |
||
170 | blend); |
||
171 | } |
||
172 | |||
173 | static void * |
||
174 | galahad_context_create_sampler_state(struct pipe_context *_pipe, |
||
175 | const struct pipe_sampler_state *sampler) |
||
176 | { |
||
177 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
178 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
179 | |||
180 | return pipe->create_sampler_state(pipe, |
||
181 | sampler); |
||
182 | } |
||
183 | |||
184 | static void |
||
185 | galahad_context_bind_sampler_states(struct pipe_context *_pipe, |
||
186 | unsigned shader, |
||
187 | unsigned start, |
||
188 | unsigned num_samplers, |
||
189 | void **samplers) |
||
190 | { |
||
191 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
192 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
193 | |||
194 | if (num_samplers > PIPE_MAX_SAMPLERS) { |
||
195 | glhd_error("%u samplers requested, " |
||
196 | "but only %u are permitted by API", |
||
197 | num_samplers, PIPE_MAX_SAMPLERS); |
||
198 | } |
||
199 | |||
200 | switch (shader) { |
||
201 | case PIPE_SHADER_VERTEX: |
||
202 | pipe->bind_vertex_sampler_states(pipe, num_samplers, samplers); |
||
203 | break; |
||
204 | case PIPE_SHADER_FRAGMENT: |
||
205 | pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers); |
||
206 | break; |
||
207 | case PIPE_SHADER_GEOMETRY: |
||
208 | pipe->bind_geometry_sampler_states(pipe, num_samplers, samplers); |
||
209 | break; |
||
210 | default: |
||
211 | assert(0); |
||
212 | } |
||
213 | } |
||
214 | |||
215 | static void |
||
216 | galahad_context_bind_vertex_sampler_states(struct pipe_context *_pipe, |
||
217 | unsigned num_samplers, |
||
218 | void **samplers) |
||
219 | { |
||
220 | galahad_context_bind_sampler_states(_pipe, PIPE_SHADER_VERTEX, |
||
221 | 0, num_samplers, samplers); |
||
222 | } |
||
223 | |||
224 | static void |
||
225 | galahad_context_bind_fragment_sampler_states(struct pipe_context *_pipe, |
||
226 | unsigned num_samplers, |
||
227 | void **samplers) |
||
228 | { |
||
229 | galahad_context_bind_sampler_states(_pipe, PIPE_SHADER_FRAGMENT, |
||
230 | 0, num_samplers, samplers); |
||
231 | } |
||
232 | |||
233 | static void |
||
234 | galahad_context_bind_geometry_sampler_states(struct pipe_context *_pipe, |
||
235 | unsigned num_samplers, |
||
236 | void **samplers) |
||
237 | { |
||
238 | galahad_context_bind_sampler_states(_pipe, PIPE_SHADER_GEOMETRY, |
||
239 | 0, num_samplers, samplers); |
||
240 | } |
||
241 | |||
242 | |||
243 | static void |
||
244 | galahad_context_delete_sampler_state(struct pipe_context *_pipe, |
||
245 | void *sampler) |
||
246 | { |
||
247 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
248 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
249 | |||
250 | pipe->delete_sampler_state(pipe, |
||
251 | sampler); |
||
252 | } |
||
253 | |||
254 | static void * |
||
255 | galahad_context_create_rasterizer_state(struct pipe_context *_pipe, |
||
256 | const struct pipe_rasterizer_state *rasterizer) |
||
257 | { |
||
258 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
259 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
260 | |||
261 | if (rasterizer->point_quad_rasterization) { |
||
262 | if (rasterizer->point_smooth) { |
||
263 | glhd_warn("Point smoothing requested but ignored"); |
||
264 | } |
||
265 | } else { |
||
266 | if (rasterizer->sprite_coord_enable) { |
||
267 | glhd_warn("Point sprites requested but ignored"); |
||
268 | } |
||
269 | } |
||
270 | |||
271 | return pipe->create_rasterizer_state(pipe, |
||
272 | rasterizer); |
||
273 | } |
||
274 | |||
275 | static void |
||
276 | galahad_context_bind_rasterizer_state(struct pipe_context *_pipe, |
||
277 | void *rasterizer) |
||
278 | { |
||
279 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
280 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
281 | |||
282 | pipe->bind_rasterizer_state(pipe, |
||
283 | rasterizer); |
||
284 | } |
||
285 | |||
286 | static void |
||
287 | galahad_context_delete_rasterizer_state(struct pipe_context *_pipe, |
||
288 | void *rasterizer) |
||
289 | { |
||
290 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
291 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
292 | |||
293 | pipe->delete_rasterizer_state(pipe, |
||
294 | rasterizer); |
||
295 | } |
||
296 | |||
297 | static void * |
||
298 | galahad_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe, |
||
299 | const struct pipe_depth_stencil_alpha_state *depth_stencil_alpha) |
||
300 | { |
||
301 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
302 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
303 | |||
304 | return pipe->create_depth_stencil_alpha_state(pipe, |
||
305 | depth_stencil_alpha); |
||
306 | } |
||
307 | |||
308 | static void |
||
309 | galahad_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, |
||
310 | void *depth_stencil_alpha) |
||
311 | { |
||
312 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
313 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
314 | |||
315 | pipe->bind_depth_stencil_alpha_state(pipe, |
||
316 | depth_stencil_alpha); |
||
317 | } |
||
318 | |||
319 | static void |
||
320 | galahad_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, |
||
321 | void *depth_stencil_alpha) |
||
322 | { |
||
323 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
324 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
325 | |||
326 | pipe->delete_depth_stencil_alpha_state(pipe, |
||
327 | depth_stencil_alpha); |
||
328 | } |
||
329 | |||
330 | #define GLHD_SHADER_STATE(shader_type) \ |
||
331 | static void * \ |
||
332 | galahad_context_create_##shader_type##_state(struct pipe_context *_pipe, \ |
||
333 | const struct pipe_shader_state *state) \ |
||
334 | { \ |
||
335 | struct galahad_context *glhd_pipe = galahad_context(_pipe); \ |
||
336 | struct pipe_context *pipe = glhd_pipe->pipe; \ |
||
337 | return pipe->create_##shader_type##_state(pipe, state); \ |
||
338 | } \ |
||
339 | \ |
||
340 | static void \ |
||
341 | galahad_context_bind_##shader_type##_state(struct pipe_context *_pipe, \ |
||
342 | void *state) \ |
||
343 | { \ |
||
344 | struct galahad_context *glhd_pipe = galahad_context(_pipe); \ |
||
345 | struct pipe_context *pipe = glhd_pipe->pipe; \ |
||
346 | pipe->bind_##shader_type##_state(pipe, state); \ |
||
347 | } \ |
||
348 | \ |
||
349 | static void \ |
||
350 | galahad_context_delete_##shader_type##_state(struct pipe_context *_pipe, \ |
||
351 | void *state) \ |
||
352 | { \ |
||
353 | struct galahad_context *glhd_pipe = galahad_context(_pipe); \ |
||
354 | struct pipe_context *pipe = glhd_pipe->pipe; \ |
||
355 | pipe->delete_##shader_type##_state(pipe, state); \ |
||
356 | } |
||
357 | |||
358 | GLHD_SHADER_STATE(fs) |
||
359 | GLHD_SHADER_STATE(vs) |
||
360 | GLHD_SHADER_STATE(gs) |
||
361 | |||
362 | #undef GLHD_SHADER_STATE |
||
363 | |||
364 | static void * |
||
365 | galahad_context_create_vertex_elements_state(struct pipe_context *_pipe, |
||
366 | unsigned num_elements, |
||
367 | const struct pipe_vertex_element *vertex_elements) |
||
368 | { |
||
369 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
370 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
371 | |||
372 | /* XXX check if stride lines up with element size, at least for floats */ |
||
373 | |||
374 | return pipe->create_vertex_elements_state(pipe, |
||
375 | num_elements, |
||
376 | vertex_elements); |
||
377 | } |
||
378 | |||
379 | static void |
||
380 | galahad_context_bind_vertex_elements_state(struct pipe_context *_pipe, |
||
381 | void *velems) |
||
382 | { |
||
383 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
384 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
385 | |||
386 | pipe->bind_vertex_elements_state(pipe, |
||
387 | velems); |
||
388 | } |
||
389 | |||
390 | static void |
||
391 | galahad_context_delete_vertex_elements_state(struct pipe_context *_pipe, |
||
392 | void *velems) |
||
393 | { |
||
394 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
395 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
396 | |||
397 | pipe->delete_vertex_elements_state(pipe, |
||
398 | velems); |
||
399 | } |
||
400 | |||
401 | static void |
||
402 | galahad_context_set_blend_color(struct pipe_context *_pipe, |
||
403 | const struct pipe_blend_color *blend_color) |
||
404 | { |
||
405 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
406 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
407 | |||
408 | pipe->set_blend_color(pipe, |
||
409 | blend_color); |
||
410 | } |
||
411 | |||
412 | static void |
||
413 | galahad_context_set_stencil_ref(struct pipe_context *_pipe, |
||
414 | const struct pipe_stencil_ref *stencil_ref) |
||
415 | { |
||
416 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
417 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
418 | |||
419 | pipe->set_stencil_ref(pipe, |
||
420 | stencil_ref); |
||
421 | } |
||
422 | |||
423 | static void |
||
424 | galahad_context_set_clip_state(struct pipe_context *_pipe, |
||
425 | const struct pipe_clip_state *clip) |
||
426 | { |
||
427 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
428 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
429 | |||
430 | pipe->set_clip_state(pipe, |
||
431 | clip); |
||
432 | } |
||
433 | |||
434 | static void |
||
435 | galahad_context_set_sample_mask(struct pipe_context *_pipe, |
||
436 | unsigned sample_mask) |
||
437 | { |
||
438 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
439 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
440 | |||
441 | pipe->set_sample_mask(pipe, |
||
442 | sample_mask); |
||
443 | } |
||
444 | |||
445 | static void |
||
446 | galahad_context_set_constant_buffer(struct pipe_context *_pipe, |
||
447 | uint shader, |
||
448 | uint index, |
||
449 | struct pipe_constant_buffer *_cb) |
||
450 | { |
||
451 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
452 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
453 | struct pipe_constant_buffer cb; |
||
454 | |||
455 | if (shader >= PIPE_SHADER_TYPES) { |
||
456 | glhd_error("Unknown shader type %u", shader); |
||
457 | } |
||
458 | |||
459 | if (index && |
||
460 | index >= |
||
461 | pipe->screen->get_shader_param(pipe->screen, shader, PIPE_SHADER_CAP_MAX_CONST_BUFFERS)) { |
||
462 | glhd_error("Access to constant buffer %u requested, " |
||
463 | "but only %d are supported", |
||
464 | index, |
||
465 | pipe->screen->get_shader_param(pipe->screen, shader, PIPE_SHADER_CAP_MAX_CONST_BUFFERS)); |
||
466 | } |
||
467 | |||
468 | /* XXX hmm? unwrap the input state */ |
||
469 | if (_cb) { |
||
470 | cb = *_cb; |
||
471 | cb.buffer = galahad_resource_unwrap(_cb->buffer); |
||
472 | } |
||
473 | |||
474 | pipe->set_constant_buffer(pipe, |
||
475 | shader, |
||
476 | index, |
||
477 | _cb ? &cb : NULL); |
||
478 | } |
||
479 | |||
480 | static void |
||
481 | galahad_context_set_framebuffer_state(struct pipe_context *_pipe, |
||
482 | const struct pipe_framebuffer_state *_state) |
||
483 | { |
||
484 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
485 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
486 | struct pipe_framebuffer_state unwrapped_state; |
||
487 | struct pipe_framebuffer_state *state = NULL; |
||
488 | unsigned i; |
||
489 | |||
490 | if (_state->nr_cbufs > PIPE_MAX_COLOR_BUFS) { |
||
491 | glhd_error("%d render targets bound, but only %d are permitted by API", |
||
492 | _state->nr_cbufs, PIPE_MAX_COLOR_BUFS); |
||
493 | } else if (_state->nr_cbufs > |
||
494 | pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_RENDER_TARGETS)) { |
||
495 | glhd_warn("%d render targets bound, but only %d are supported", |
||
496 | _state->nr_cbufs, |
||
497 | pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_RENDER_TARGETS)); |
||
498 | } |
||
499 | |||
500 | /* unwrap the input state */ |
||
501 | if (_state) { |
||
502 | memcpy(&unwrapped_state, _state, sizeof(unwrapped_state)); |
||
503 | for(i = 0; i < _state->nr_cbufs; i++) |
||
504 | unwrapped_state.cbufs[i] = galahad_surface_unwrap(_state->cbufs[i]); |
||
505 | for (; i < PIPE_MAX_COLOR_BUFS; i++) |
||
506 | unwrapped_state.cbufs[i] = NULL; |
||
507 | unwrapped_state.zsbuf = galahad_surface_unwrap(_state->zsbuf); |
||
508 | state = &unwrapped_state; |
||
509 | } |
||
510 | |||
511 | pipe->set_framebuffer_state(pipe, |
||
512 | state); |
||
513 | } |
||
514 | |||
515 | static void |
||
516 | galahad_context_set_polygon_stipple(struct pipe_context *_pipe, |
||
517 | const struct pipe_poly_stipple *poly_stipple) |
||
518 | { |
||
519 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
520 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
521 | |||
522 | pipe->set_polygon_stipple(pipe, |
||
523 | poly_stipple); |
||
524 | } |
||
525 | |||
526 | static void |
||
527 | galahad_context_set_scissor_states(struct pipe_context *_pipe, |
||
528 | unsigned start_slot, |
||
529 | unsigned num_scissors, |
||
530 | const struct pipe_scissor_state *scissor) |
||
531 | { |
||
532 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
533 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
534 | |||
535 | pipe->set_scissor_states(pipe, start_slot, num_scissors, |
||
536 | scissor); |
||
537 | } |
||
538 | |||
539 | static void |
||
540 | galahad_context_set_viewport_states(struct pipe_context *_pipe, |
||
541 | unsigned start_slot, |
||
542 | unsigned num_viewports, |
||
543 | const struct pipe_viewport_state *viewport) |
||
544 | { |
||
545 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
546 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
547 | |||
548 | pipe->set_viewport_states(pipe, start_slot, num_viewports, |
||
549 | viewport); |
||
550 | } |
||
551 | |||
552 | static void |
||
553 | galahad_context_set_sampler_views(struct pipe_context *_pipe, |
||
554 | unsigned shader, |
||
555 | unsigned start, |
||
556 | unsigned num, |
||
557 | struct pipe_sampler_view **_views) |
||
558 | { |
||
559 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
560 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
561 | struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS]; |
||
562 | struct pipe_sampler_view **views = NULL; |
||
563 | unsigned i; |
||
564 | |||
565 | if (_views) { |
||
566 | for (i = 0; i < num; i++) |
||
567 | unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]); |
||
568 | for (; i < PIPE_MAX_SAMPLERS; i++) |
||
569 | unwrapped_views[i] = NULL; |
||
570 | |||
571 | views = unwrapped_views; |
||
572 | } |
||
573 | |||
574 | switch (shader) { |
||
575 | case PIPE_SHADER_VERTEX: |
||
576 | pipe->set_vertex_sampler_views(pipe, num, views); |
||
577 | break; |
||
578 | case PIPE_SHADER_FRAGMENT: |
||
579 | pipe->set_fragment_sampler_views(pipe, num, views); |
||
580 | break; |
||
581 | case PIPE_SHADER_GEOMETRY: |
||
582 | pipe->set_geometry_sampler_views(pipe, num, views); |
||
583 | break; |
||
584 | default: |
||
585 | assert(0); |
||
586 | } |
||
587 | } |
||
588 | |||
589 | static void |
||
590 | galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe, |
||
591 | unsigned num, |
||
592 | struct pipe_sampler_view **_views) |
||
593 | { |
||
594 | galahad_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX, |
||
595 | 0, num, _views); |
||
596 | } |
||
597 | |||
598 | static void |
||
599 | galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe, |
||
600 | unsigned num, |
||
601 | struct pipe_sampler_view **_views) |
||
602 | { |
||
603 | galahad_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT, |
||
604 | 0, num, _views); |
||
605 | } |
||
606 | |||
607 | static void |
||
608 | galahad_context_set_geometry_sampler_views(struct pipe_context *_pipe, |
||
609 | unsigned num, |
||
610 | struct pipe_sampler_view **_views) |
||
611 | { |
||
612 | galahad_context_set_sampler_views(_pipe, PIPE_SHADER_GEOMETRY, |
||
613 | 0, num, _views); |
||
614 | } |
||
615 | |||
616 | static void |
||
617 | galahad_context_set_vertex_buffers(struct pipe_context *_pipe, |
||
618 | unsigned start_slot, unsigned num_buffers, |
||
619 | const struct pipe_vertex_buffer *_buffers) |
||
620 | { |
||
621 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
622 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
623 | struct pipe_vertex_buffer unwrapped_buffers[PIPE_MAX_SHADER_INPUTS]; |
||
624 | struct pipe_vertex_buffer *buffers = NULL; |
||
625 | unsigned i; |
||
626 | |||
627 | if (num_buffers && _buffers) { |
||
628 | memcpy(unwrapped_buffers, _buffers, num_buffers * sizeof(*_buffers)); |
||
629 | for (i = 0; i < num_buffers; i++) |
||
630 | unwrapped_buffers[i].buffer = galahad_resource_unwrap(_buffers[i].buffer); |
||
631 | buffers = unwrapped_buffers; |
||
632 | } |
||
633 | |||
634 | pipe->set_vertex_buffers(pipe, |
||
635 | start_slot, num_buffers, |
||
636 | buffers); |
||
637 | } |
||
638 | |||
639 | static void |
||
640 | galahad_context_set_index_buffer(struct pipe_context *_pipe, |
||
641 | const struct pipe_index_buffer *_ib) |
||
642 | { |
||
643 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
644 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
645 | struct pipe_index_buffer unwrapped_ib, *ib = NULL; |
||
646 | |||
647 | if (_ib) { |
||
648 | if (_ib->buffer || _ib->user_buffer) { |
||
649 | switch (_ib->index_size) { |
||
650 | case 1: |
||
651 | case 2: |
||
652 | case 4: |
||
653 | break; |
||
654 | default: |
||
655 | glhd_warn("unrecognized index size %d", _ib->index_size); |
||
656 | break; |
||
657 | } |
||
658 | } |
||
659 | else if (_ib->offset || _ib->index_size) { |
||
660 | glhd_warn("non-indexed state with index offset %d and index size %d", |
||
661 | _ib->offset, _ib->index_size); |
||
662 | } |
||
663 | |||
664 | unwrapped_ib = *_ib; |
||
665 | unwrapped_ib.buffer = galahad_resource_unwrap(_ib->buffer); |
||
666 | ib = &unwrapped_ib; |
||
667 | } |
||
668 | |||
669 | pipe->set_index_buffer(pipe, ib); |
||
670 | } |
||
671 | |||
672 | static INLINE struct pipe_stream_output_target * |
||
673 | galahad_context_create_stream_output_target(struct pipe_context *_pipe, |
||
674 | struct pipe_resource *_res, |
||
675 | unsigned buffer_offset, |
||
676 | unsigned buffer_size) |
||
677 | { |
||
678 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
679 | struct galahad_resource *glhd_resource_res = galahad_resource(_res); |
||
680 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
681 | struct pipe_resource *res = glhd_resource_res->resource; |
||
682 | |||
683 | return pipe->create_stream_output_target(pipe, |
||
684 | res, buffer_offset, buffer_size); |
||
685 | } |
||
686 | |||
687 | static INLINE void |
||
688 | galahad_context_stream_output_target_destroy( |
||
689 | struct pipe_context *_pipe, |
||
690 | struct pipe_stream_output_target *target) |
||
691 | { |
||
692 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
693 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
694 | |||
695 | pipe->stream_output_target_destroy(pipe, target); |
||
696 | } |
||
697 | |||
698 | static INLINE void |
||
699 | galahad_context_set_stream_output_targets(struct pipe_context *_pipe, |
||
700 | unsigned num_targets, |
||
701 | struct pipe_stream_output_target **tgs, |
||
702 | unsigned append_bitmask) |
||
703 | { |
||
704 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
705 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
706 | |||
707 | pipe->set_stream_output_targets(pipe, num_targets, tgs, append_bitmask); |
||
708 | } |
||
709 | |||
710 | static void |
||
711 | galahad_context_resource_copy_region(struct pipe_context *_pipe, |
||
712 | struct pipe_resource *_dst, |
||
713 | unsigned dst_level, |
||
714 | unsigned dstx, |
||
715 | unsigned dsty, |
||
716 | unsigned dstz, |
||
717 | struct pipe_resource *_src, |
||
718 | unsigned src_level, |
||
719 | const struct pipe_box *src_box) |
||
720 | { |
||
721 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
722 | struct galahad_resource *glhd_resource_dst = galahad_resource(_dst); |
||
723 | struct galahad_resource *glhd_resource_src = galahad_resource(_src); |
||
724 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
725 | struct pipe_resource *dst = glhd_resource_dst->resource; |
||
726 | struct pipe_resource *src = glhd_resource_src->resource; |
||
727 | |||
728 | if (_dst->format != _src->format) { |
||
729 | const struct util_format_description *src_desc = |
||
730 | util_format_description(_src->format); |
||
731 | const struct util_format_description *dst_desc = |
||
732 | util_format_description(_dst->format); |
||
733 | if (!util_is_format_compatible(src_desc, dst_desc)) |
||
734 | glhd_warn("Format mismatch: Source is %s, destination is %s", |
||
735 | src_desc->short_name, |
||
736 | dst_desc->short_name); |
||
737 | } |
||
738 | |||
739 | if ((_src->target == PIPE_BUFFER && _dst->target != PIPE_BUFFER) || |
||
740 | (_src->target != PIPE_BUFFER && _dst->target == PIPE_BUFFER)) { |
||
741 | glhd_warn("Resource target mismatch: Source is %i, destination is %i", |
||
742 | _src->target, _dst->target); |
||
743 | } |
||
744 | |||
745 | pipe->resource_copy_region(pipe, |
||
746 | dst, |
||
747 | dst_level, |
||
748 | dstx, |
||
749 | dsty, |
||
750 | dstz, |
||
751 | src, |
||
752 | src_level, |
||
753 | src_box); |
||
754 | } |
||
755 | |||
756 | static void |
||
757 | galahad_context_blit(struct pipe_context *_pipe, |
||
758 | const struct pipe_blit_info *_info) |
||
759 | { |
||
760 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
761 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
762 | struct pipe_blit_info info = *_info; |
||
763 | |||
764 | info.dst.resource = galahad_resource_unwrap(info.dst.resource); |
||
765 | info.src.resource = galahad_resource_unwrap(info.src.resource); |
||
766 | |||
767 | if (info.dst.box.width < 0 || |
||
768 | info.dst.box.height < 0) |
||
769 | glhd_error("Destination dimensions are negative"); |
||
770 | |||
771 | if (info.filter != PIPE_TEX_FILTER_NEAREST && |
||
772 | info.src.resource->target != PIPE_TEXTURE_3D && |
||
773 | info.dst.box.depth != info.src.box.depth) |
||
774 | glhd_error("Filtering in z-direction on non-3D texture"); |
||
775 | |||
776 | if (util_format_is_depth_or_stencil(info.dst.format) != |
||
777 | util_format_is_depth_or_stencil(info.src.format)) |
||
778 | glhd_error("Invalid format conversion: %s <- %s\n", |
||
779 | util_format_name(info.dst.format), |
||
780 | util_format_name(info.src.format)); |
||
781 | |||
782 | pipe->blit(pipe, &info); |
||
783 | } |
||
784 | |||
785 | static void |
||
786 | galahad_context_clear(struct pipe_context *_pipe, |
||
787 | unsigned buffers, |
||
788 | const union pipe_color_union *color, |
||
789 | double depth, |
||
790 | unsigned stencil) |
||
791 | { |
||
792 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
793 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
794 | |||
795 | pipe->clear(pipe, |
||
796 | buffers, |
||
797 | color, |
||
798 | depth, |
||
799 | stencil); |
||
800 | } |
||
801 | |||
802 | static void |
||
803 | galahad_context_clear_render_target(struct pipe_context *_pipe, |
||
804 | struct pipe_surface *_dst, |
||
805 | const union pipe_color_union *color, |
||
806 | unsigned dstx, unsigned dsty, |
||
807 | unsigned width, unsigned height) |
||
808 | { |
||
809 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
810 | struct galahad_surface *glhd_surface_dst = galahad_surface(_dst); |
||
811 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
812 | struct pipe_surface *dst = glhd_surface_dst->surface; |
||
813 | |||
814 | pipe->clear_render_target(pipe, |
||
815 | dst, |
||
816 | color, |
||
817 | dstx, |
||
818 | dsty, |
||
819 | width, |
||
820 | height); |
||
821 | } |
||
822 | static void |
||
823 | galahad_context_clear_depth_stencil(struct pipe_context *_pipe, |
||
824 | struct pipe_surface *_dst, |
||
825 | unsigned clear_flags, |
||
826 | double depth, |
||
827 | unsigned stencil, |
||
828 | unsigned dstx, unsigned dsty, |
||
829 | unsigned width, unsigned height) |
||
830 | { |
||
831 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
832 | struct galahad_surface *glhd_surface_dst = galahad_surface(_dst); |
||
833 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
834 | struct pipe_surface *dst = glhd_surface_dst->surface; |
||
835 | |||
836 | pipe->clear_depth_stencil(pipe, |
||
837 | dst, |
||
838 | clear_flags, |
||
839 | depth, |
||
840 | stencil, |
||
841 | dstx, |
||
842 | dsty, |
||
843 | width, |
||
844 | height); |
||
845 | |||
846 | } |
||
847 | |||
848 | static void |
||
849 | galahad_context_flush(struct pipe_context *_pipe, |
||
850 | struct pipe_fence_handle **fence, |
||
851 | unsigned flags) |
||
852 | { |
||
853 | struct galahad_context *glhd_pipe = galahad_context(_pipe); |
||
854 | struct pipe_context *pipe = glhd_pipe->pipe; |
||
855 | |||
856 | pipe->flush(pipe, fence, flags); |
||
857 | } |
||
858 | |||
859 | static struct pipe_sampler_view * |
||
860 | galahad_context_create_sampler_view(struct pipe_context *_pipe, |
||
861 | struct pipe_resource *_resource, |
||
862 | const struct pipe_sampler_view *templ) |
||
863 | { |
||
864 | struct galahad_context *glhd_context = galahad_context(_pipe); |
||
865 | struct galahad_resource *glhd_resource = galahad_resource(_resource); |
||
866 | struct pipe_context *pipe = glhd_context->pipe; |
||
867 | struct pipe_resource *resource = glhd_resource->resource; |
||
868 | struct pipe_sampler_view *result; |
||
869 | |||
870 | result = pipe->create_sampler_view(pipe, |
||
871 | resource, |
||
872 | templ); |
||
873 | |||
874 | if (result) |
||
875 | return galahad_sampler_view_create(glhd_context, glhd_resource, result); |
||
876 | return NULL; |
||
877 | } |
||
878 | |||
879 | static void |
||
880 | galahad_context_sampler_view_destroy(struct pipe_context *_pipe, |
||
881 | struct pipe_sampler_view *_view) |
||
882 | { |
||
883 | galahad_sampler_view_destroy(galahad_context(_pipe), |
||
884 | galahad_sampler_view(_view)); |
||
885 | } |
||
886 | |||
887 | static struct pipe_surface * |
||
888 | galahad_context_create_surface(struct pipe_context *_pipe, |
||
889 | struct pipe_resource *_resource, |
||
890 | const struct pipe_surface *templ) |
||
891 | { |
||
892 | struct galahad_context *glhd_context = galahad_context(_pipe); |
||
893 | struct galahad_resource *glhd_resource = galahad_resource(_resource); |
||
894 | struct pipe_context *pipe = glhd_context->pipe; |
||
895 | struct pipe_resource *resource = glhd_resource->resource; |
||
896 | struct pipe_surface *result; |
||
897 | |||
898 | result = pipe->create_surface(pipe, |
||
899 | resource, |
||
900 | templ); |
||
901 | |||
902 | if (result) |
||
903 | return galahad_surface_create(glhd_context, glhd_resource, result); |
||
904 | return NULL; |
||
905 | } |
||
906 | |||
907 | static void |
||
908 | galahad_context_surface_destroy(struct pipe_context *_pipe, |
||
909 | struct pipe_surface *_surface) |
||
910 | { |
||
911 | galahad_surface_destroy(galahad_context(_pipe), |
||
912 | galahad_surface(_surface)); |
||
913 | } |
||
914 | |||
915 | |||
916 | static void * |
||
917 | galahad_context_transfer_map(struct pipe_context *_context, |
||
918 | struct pipe_resource *_resource, |
||
919 | unsigned level, |
||
920 | unsigned usage, |
||
921 | const struct pipe_box *box, |
||
922 | struct pipe_transfer **transfer) |
||
923 | { |
||
924 | struct galahad_context *glhd_context = galahad_context(_context); |
||
925 | struct galahad_resource *glhd_resource = galahad_resource(_resource); |
||
926 | struct pipe_context *context = glhd_context->pipe; |
||
927 | struct pipe_resource *resource = glhd_resource->resource; |
||
928 | struct pipe_transfer *result; |
||
929 | void *map; |
||
930 | |||
931 | map = context->transfer_map(context, |
||
932 | resource, |
||
933 | level, |
||
934 | usage, |
||
935 | box, &result); |
||
936 | if (!map) |
||
937 | return NULL; |
||
938 | |||
939 | glhd_resource->map_count++; |
||
940 | |||
941 | *transfer = galahad_transfer_create(glhd_context, glhd_resource, result); |
||
942 | return *transfer ? map : NULL; |
||
943 | } |
||
944 | |||
945 | static void |
||
946 | galahad_context_transfer_flush_region(struct pipe_context *_context, |
||
947 | struct pipe_transfer *_transfer, |
||
948 | const struct pipe_box *box) |
||
949 | { |
||
950 | struct galahad_context *glhd_context = galahad_context(_context); |
||
951 | struct galahad_transfer *glhd_transfer = galahad_transfer(_transfer); |
||
952 | struct pipe_context *context = glhd_context->pipe; |
||
953 | struct pipe_transfer *transfer = glhd_transfer->transfer; |
||
954 | |||
955 | context->transfer_flush_region(context, |
||
956 | transfer, |
||
957 | box); |
||
958 | } |
||
959 | |||
960 | static void |
||
961 | galahad_context_transfer_unmap(struct pipe_context *_context, |
||
962 | struct pipe_transfer *_transfer) |
||
963 | { |
||
964 | struct galahad_context *glhd_context = galahad_context(_context); |
||
965 | struct galahad_transfer *glhd_transfer = galahad_transfer(_transfer); |
||
966 | struct pipe_context *context = glhd_context->pipe; |
||
967 | struct pipe_transfer *transfer = glhd_transfer->transfer; |
||
968 | struct galahad_resource *glhd_resource = galahad_resource(_transfer->resource); |
||
969 | |||
970 | if (glhd_resource->map_count < 1) { |
||
971 | glhd_warn("context::transfer_unmap() called too many times" |
||
972 | " (count = %d)\n", glhd_resource->map_count); |
||
973 | } |
||
974 | |||
975 | glhd_resource->map_count--; |
||
976 | |||
977 | context->transfer_unmap(context, |
||
978 | transfer); |
||
979 | |||
980 | galahad_transfer_destroy(galahad_context(_context), |
||
981 | galahad_transfer(_transfer)); |
||
982 | } |
||
983 | |||
984 | |||
985 | static void |
||
986 | galahad_context_transfer_inline_write(struct pipe_context *_context, |
||
987 | struct pipe_resource *_resource, |
||
988 | unsigned level, |
||
989 | unsigned usage, |
||
990 | const struct pipe_box *box, |
||
991 | const void *data, |
||
992 | unsigned stride, |
||
993 | unsigned slice_stride) |
||
994 | { |
||
995 | struct galahad_context *glhd_context = galahad_context(_context); |
||
996 | struct galahad_resource *glhd_resource = galahad_resource(_resource); |
||
997 | struct pipe_context *context = glhd_context->pipe; |
||
998 | struct pipe_resource *resource = glhd_resource->resource; |
||
999 | |||
1000 | context->transfer_inline_write(context, |
||
1001 | resource, |
||
1002 | level, |
||
1003 | usage, |
||
1004 | box, |
||
1005 | data, |
||
1006 | stride, |
||
1007 | slice_stride); |
||
1008 | } |
||
1009 | |||
1010 | |||
1011 | static void |
||
1012 | galahad_context_render_condition(struct pipe_context *_context, |
||
1013 | struct pipe_query *query, |
||
1014 | boolean condition, |
||
1015 | uint mode) |
||
1016 | { |
||
1017 | struct galahad_context *glhd_context = galahad_context(_context); |
||
1018 | struct pipe_context *context = glhd_context->pipe; |
||
1019 | |||
1020 | context->render_condition(context, query, condition, mode); |
||
1021 | } |
||
1022 | |||
1023 | |||
1024 | struct pipe_context * |
||
1025 | galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) |
||
1026 | { |
||
1027 | struct galahad_context *glhd_pipe; |
||
1028 | (void)galahad_screen(_screen); |
||
1029 | |||
1030 | glhd_pipe = CALLOC_STRUCT(galahad_context); |
||
1031 | if (!glhd_pipe) { |
||
1032 | return NULL; |
||
1033 | } |
||
1034 | |||
1035 | glhd_pipe->base.screen = _screen; |
||
1036 | glhd_pipe->base.priv = pipe->priv; /* expose wrapped data */ |
||
1037 | glhd_pipe->base.draw = NULL; |
||
1038 | |||
1039 | glhd_pipe->base.destroy = galahad_context_destroy; |
||
1040 | |||
1041 | #define GLHD_PIPE_INIT(_member) \ |
||
1042 | glhd_pipe->base . _member = pipe -> _member ? galahad_context_ ## _member : NULL |
||
1043 | |||
1044 | GLHD_PIPE_INIT(draw_vbo); |
||
1045 | GLHD_PIPE_INIT(render_condition); |
||
1046 | GLHD_PIPE_INIT(create_query); |
||
1047 | GLHD_PIPE_INIT(destroy_query); |
||
1048 | GLHD_PIPE_INIT(begin_query); |
||
1049 | GLHD_PIPE_INIT(end_query); |
||
1050 | GLHD_PIPE_INIT(get_query_result); |
||
1051 | GLHD_PIPE_INIT(create_blend_state); |
||
1052 | GLHD_PIPE_INIT(bind_blend_state); |
||
1053 | GLHD_PIPE_INIT(delete_blend_state); |
||
1054 | GLHD_PIPE_INIT(create_sampler_state); |
||
1055 | GLHD_PIPE_INIT(bind_fragment_sampler_states); |
||
1056 | GLHD_PIPE_INIT(bind_vertex_sampler_states); |
||
1057 | GLHD_PIPE_INIT(bind_geometry_sampler_states); |
||
1058 | //GLHD_PIPE_INIT(bind_compute_sampler_states); |
||
1059 | GLHD_PIPE_INIT(delete_sampler_state); |
||
1060 | GLHD_PIPE_INIT(create_rasterizer_state); |
||
1061 | GLHD_PIPE_INIT(bind_rasterizer_state); |
||
1062 | GLHD_PIPE_INIT(delete_rasterizer_state); |
||
1063 | GLHD_PIPE_INIT(create_depth_stencil_alpha_state); |
||
1064 | GLHD_PIPE_INIT(bind_depth_stencil_alpha_state); |
||
1065 | GLHD_PIPE_INIT(delete_depth_stencil_alpha_state); |
||
1066 | GLHD_PIPE_INIT(create_fs_state); |
||
1067 | GLHD_PIPE_INIT(bind_fs_state); |
||
1068 | GLHD_PIPE_INIT(delete_fs_state); |
||
1069 | GLHD_PIPE_INIT(create_vs_state); |
||
1070 | GLHD_PIPE_INIT(bind_vs_state); |
||
1071 | GLHD_PIPE_INIT(delete_vs_state); |
||
1072 | GLHD_PIPE_INIT(create_gs_state); |
||
1073 | GLHD_PIPE_INIT(bind_gs_state); |
||
1074 | GLHD_PIPE_INIT(delete_gs_state); |
||
1075 | GLHD_PIPE_INIT(create_vertex_elements_state); |
||
1076 | GLHD_PIPE_INIT(bind_vertex_elements_state); |
||
1077 | GLHD_PIPE_INIT(delete_vertex_elements_state); |
||
1078 | GLHD_PIPE_INIT(set_blend_color); |
||
1079 | GLHD_PIPE_INIT(set_stencil_ref); |
||
1080 | GLHD_PIPE_INIT(set_sample_mask); |
||
1081 | GLHD_PIPE_INIT(set_clip_state); |
||
1082 | GLHD_PIPE_INIT(set_constant_buffer); |
||
1083 | GLHD_PIPE_INIT(set_framebuffer_state); |
||
1084 | GLHD_PIPE_INIT(set_polygon_stipple); |
||
1085 | GLHD_PIPE_INIT(set_scissor_states); |
||
1086 | GLHD_PIPE_INIT(set_viewport_states); |
||
1087 | GLHD_PIPE_INIT(set_fragment_sampler_views); |
||
1088 | GLHD_PIPE_INIT(set_vertex_sampler_views); |
||
1089 | GLHD_PIPE_INIT(set_geometry_sampler_views); |
||
1090 | //GLHD_PIPE_INIT(set_compute_sampler_views); |
||
1091 | //GLHD_PIPE_INIT(set_shader_resources); |
||
1092 | GLHD_PIPE_INIT(set_vertex_buffers); |
||
1093 | GLHD_PIPE_INIT(set_index_buffer); |
||
1094 | GLHD_PIPE_INIT(create_stream_output_target); |
||
1095 | GLHD_PIPE_INIT(stream_output_target_destroy); |
||
1096 | GLHD_PIPE_INIT(set_stream_output_targets); |
||
1097 | GLHD_PIPE_INIT(resource_copy_region); |
||
1098 | GLHD_PIPE_INIT(blit); |
||
1099 | GLHD_PIPE_INIT(clear); |
||
1100 | GLHD_PIPE_INIT(clear_render_target); |
||
1101 | GLHD_PIPE_INIT(clear_depth_stencil); |
||
1102 | GLHD_PIPE_INIT(flush); |
||
1103 | GLHD_PIPE_INIT(create_sampler_view); |
||
1104 | GLHD_PIPE_INIT(sampler_view_destroy); |
||
1105 | GLHD_PIPE_INIT(create_surface); |
||
1106 | GLHD_PIPE_INIT(surface_destroy); |
||
1107 | GLHD_PIPE_INIT(transfer_map); |
||
1108 | GLHD_PIPE_INIT(transfer_flush_region); |
||
1109 | GLHD_PIPE_INIT(transfer_unmap); |
||
1110 | GLHD_PIPE_INIT(transfer_inline_write); |
||
1111 | //GLHD_PIPE_INIT(texture_barrier); |
||
1112 | //GLHD_PIPE_INIT(create_video_decoder); |
||
1113 | //GLHD_PIPE_INIT(create_video_buffer); |
||
1114 | //GLHD_PIPE_INIT(create_compute_state); |
||
1115 | //GLHD_PIPE_INIT(bind_compute_state); |
||
1116 | //GLHD_PIPE_INIT(delete_compute_state); |
||
1117 | //GLHD_PIPE_INIT(set_compute_resources); |
||
1118 | //GLHD_PIPE_INIT(set_global_binding); |
||
1119 | //GLHD_PIPE_INIT(launch_grid); |
||
1120 | |||
1121 | #undef GLHD_PIPE_INIT |
||
1122 | |||
1123 | glhd_pipe->pipe = pipe; |
||
1124 | |||
1125 | return &glhd_pipe->base; |
||
1126 | }>->>>>>>>> |