r300-gallium: Clean up compile warnings and strict compile errors.
[mesa.git] / src / gallium / drivers / r300 / r300_state.c
1 /*
2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #include "util/u_math.h"
24 #include "util/u_pack_color.h"
25
26 #include "util/u_debug.h"
27 #include "pipe/internal/p_winsys_screen.h"
28
29 #include "r300_context.h"
30 #include "r300_reg.h"
31 #include "r300_state_inlines.h"
32 #include "r300_state_shader.h"
33
34 /* r300_state: Functions used to intialize state context by translating
35 * Gallium state objects into semi-native r300 state objects. */
36
37 /* Create a new blend state based on the CSO blend state.
38 *
39 * This encompasses alpha blending, logic/raster ops, and blend dithering. */
40 static void* r300_create_blend_state(struct pipe_context* pipe,
41 const struct pipe_blend_state* state)
42 {
43 struct r300_blend_state* blend = CALLOC_STRUCT(r300_blend_state);
44
45 if (state->blend_enable) {
46 /* XXX for now, always do separate alpha...
47 * is it faster to do it with one reg? */
48 blend->blend_control = R300_ALPHA_BLEND_ENABLE |
49 R300_SEPARATE_ALPHA_ENABLE |
50 R300_READ_ENABLE |
51 r300_translate_blend_function(state->rgb_func) |
52 (r300_translate_blend_factor(state->rgb_src_factor) <<
53 R300_SRC_BLEND_SHIFT) |
54 (r300_translate_blend_factor(state->rgb_dst_factor) <<
55 R300_DST_BLEND_SHIFT);
56 blend->alpha_blend_control =
57 r300_translate_blend_function(state->alpha_func) |
58 (r300_translate_blend_factor(state->alpha_src_factor) <<
59 R300_SRC_BLEND_SHIFT) |
60 (r300_translate_blend_factor(state->alpha_dst_factor) <<
61 R300_DST_BLEND_SHIFT);
62 }
63
64 /* PIPE_LOGICOP_* don't need to be translated, fortunately. */
65 /* XXX are logicops still allowed if blending's disabled?
66 * Does Gallium take care of it for us? */
67 if (state->logicop_enable) {
68 blend->rop = R300_RB3D_ROPCNTL_ROP_ENABLE |
69 (state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT;
70 }
71
72 if (state->dither) {
73 blend->dither = R300_RB3D_DITHER_CTL_DITHER_MODE_LUT |
74 R300_RB3D_DITHER_CTL_ALPHA_DITHER_MODE_LUT;
75 }
76
77 return (void*)blend;
78 }
79
80 /* Bind blend state. */
81 static void r300_bind_blend_state(struct pipe_context* pipe,
82 void* state)
83 {
84 struct r300_context* r300 = r300_context(pipe);
85
86 r300->blend_state = (struct r300_blend_state*)state;
87 r300->dirty_state |= R300_NEW_BLEND;
88 }
89
90 /* Free blend state. */
91 static void r300_delete_blend_state(struct pipe_context* pipe,
92 void* state)
93 {
94 FREE(state);
95 }
96
97 /* Set blend color.
98 * Setup both R300 and R500 registers, figure out later which one to write. */
99 static void r300_set_blend_color(struct pipe_context* pipe,
100 const struct pipe_blend_color* color)
101 {
102 struct r300_context* r300 = r300_context(pipe);
103 ubyte ur, ug, ub, ua;
104
105 ur = float_to_ubyte(color->color[0]);
106 ug = float_to_ubyte(color->color[1]);
107 ub = float_to_ubyte(color->color[2]);
108 ua = float_to_ubyte(color->color[3]);
109
110 util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM,
111 &r300->blend_color_state->blend_color);
112
113 /* XXX this is wrong */
114 r300->blend_color_state->blend_color_red_alpha = ur | (ua << 16);
115 r300->blend_color_state->blend_color_green_blue = ub | (ug << 16);
116
117 r300->dirty_state |= R300_NEW_BLEND_COLOR;
118 }
119
120 static void r300_set_clip_state(struct pipe_context* pipe,
121 const struct pipe_clip_state* state)
122 {
123 struct r300_context* r300 = r300_context(pipe);
124 /* XXX Draw */
125 draw_flush(r300->draw);
126 draw_set_clip_state(r300->draw, state);
127 }
128
129 static void
130 r300_set_constant_buffer(struct pipe_context* pipe,
131 uint shader, uint index,
132 const struct pipe_constant_buffer* buffer)
133 {
134 struct r300_context* r300 = r300_context(pipe);
135 int i = r300->shader_constants[shader].user_count;
136
137 /* This entire chunk of code seems ever-so-slightly baked.
138 * It's as if I've got pipe_buffer* matryoshkas... */
139 if (buffer && buffer->buffer && buffer->buffer->size) {
140 void* map = pipe->winsys->buffer_map(pipe->winsys, buffer->buffer,
141 PIPE_BUFFER_USAGE_CPU_READ);
142 memcpy(r300->shader_constants[shader].constants,
143 map, buffer->buffer->size);
144 pipe->winsys->buffer_unmap(pipe->winsys, buffer->buffer);
145
146 r300->shader_constants[shader].user_count =
147 buffer->buffer->size / (sizeof(float) * 4);
148 } else {
149 r300->shader_constants[shader].user_count = 0;
150 }
151
152 r300->dirty_state |= R300_NEW_CONSTANTS;
153
154 /* If the number of constants have changed, invalidate the shader. */
155 if (r300->shader_constants[shader].user_count != i) {
156 r300->fs->translated = FALSE;
157 r300_translate_fragment_shader(r300, r300->fs);
158 }
159 }
160
161 /* Create a new depth, stencil, and alpha state based on the CSO dsa state.
162 *
163 * This contains the depth buffer, stencil buffer, alpha test, and such.
164 * On the Radeon, depth and stencil buffer setup are intertwined, which is
165 * the reason for some of the strange-looking assignments across registers. */
166 static void*
167 r300_create_dsa_state(struct pipe_context* pipe,
168 const struct pipe_depth_stencil_alpha_state* state)
169 {
170 struct r300_dsa_state* dsa = CALLOC_STRUCT(r300_dsa_state);
171
172 /* Depth test setup. */
173 if (state->depth.enabled) {
174 dsa->z_buffer_control |= R300_Z_ENABLE;
175
176 if (state->depth.writemask) {
177 dsa->z_buffer_control |= R300_Z_WRITE_ENABLE;
178 }
179
180 dsa->z_stencil_control |=
181 (r300_translate_depth_stencil_function(state->depth.func) <<
182 R300_Z_FUNC_SHIFT);
183 }
184
185 /* Stencil buffer setup. */
186 if (state->stencil[0].enabled) {
187 dsa->z_buffer_control |= R300_STENCIL_ENABLE;
188 dsa->z_stencil_control |=
189 (r300_translate_depth_stencil_function(state->stencil[0].func) <<
190 R300_S_FRONT_FUNC_SHIFT) |
191 (r300_translate_stencil_op(state->stencil[0].fail_op) <<
192 R300_S_FRONT_SFAIL_OP_SHIFT) |
193 (r300_translate_stencil_op(state->stencil[0].zpass_op) <<
194 R300_S_FRONT_ZPASS_OP_SHIFT) |
195 (r300_translate_stencil_op(state->stencil[0].zfail_op) <<
196 R300_S_FRONT_ZFAIL_OP_SHIFT);
197
198 dsa->stencil_ref_mask = (state->stencil[0].ref_value) |
199 (state->stencil[0].valuemask << R300_STENCILMASK_SHIFT) |
200 (state->stencil[0].writemask << R300_STENCILWRITEMASK_SHIFT);
201
202 if (state->stencil[1].enabled) {
203 dsa->z_buffer_control |= R300_STENCIL_FRONT_BACK;
204 dsa->z_stencil_control |=
205 (r300_translate_depth_stencil_function(state->stencil[1].func) <<
206 R300_S_BACK_FUNC_SHIFT) |
207 (r300_translate_stencil_op(state->stencil[1].fail_op) <<
208 R300_S_BACK_SFAIL_OP_SHIFT) |
209 (r300_translate_stencil_op(state->stencil[1].zpass_op) <<
210 R300_S_BACK_ZPASS_OP_SHIFT) |
211 (r300_translate_stencil_op(state->stencil[1].zfail_op) <<
212 R300_S_BACK_ZFAIL_OP_SHIFT);
213
214 dsa->stencil_ref_bf = (state->stencil[1].ref_value) |
215 (state->stencil[1].valuemask << R300_STENCILMASK_SHIFT) |
216 (state->stencil[1].writemask << R300_STENCILWRITEMASK_SHIFT);
217 }
218 }
219
220 /* Alpha test setup. */
221 if (state->alpha.enabled) {
222 dsa->alpha_function =
223 r300_translate_alpha_function(state->alpha.func) |
224 R300_FG_ALPHA_FUNC_ENABLE;
225 dsa->alpha_reference = CLAMP(state->alpha.ref_value * 1023.0f,
226 0, 1023);
227 } else {
228 dsa->z_buffer_top = R300_ZTOP_ENABLE;
229 }
230
231 return (void*)dsa;
232 }
233
234 /* Bind DSA state. */
235 static void r300_bind_dsa_state(struct pipe_context* pipe,
236 void* state)
237 {
238 struct r300_context* r300 = r300_context(pipe);
239
240 r300->dsa_state = (struct r300_dsa_state*)state;
241 r300->dirty_state |= R300_NEW_DSA;
242 }
243
244 /* Free DSA state. */
245 static void r300_delete_dsa_state(struct pipe_context* pipe,
246 void* state)
247 {
248 FREE(state);
249 }
250
251 static void r300_set_edgeflags(struct pipe_context* pipe,
252 const unsigned* bitfield)
253 {
254 /* XXX you know it's bad when i915 has this blank too */
255 }
256
257 static void
258 r300_set_framebuffer_state(struct pipe_context* pipe,
259 const struct pipe_framebuffer_state* state)
260 {
261 struct r300_context* r300 = r300_context(pipe);
262
263 draw_flush(r300->draw);
264
265 r300->framebuffer_state = *state;
266
267 r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
268 }
269
270 /* Create fragment shader state. */
271 static void* r300_create_fs_state(struct pipe_context* pipe,
272 const struct pipe_shader_state* shader)
273 {
274 struct r300_context* r300 = r300_context(pipe);
275 struct r3xx_fragment_shader* fs = NULL;
276
277 if (r300_screen(r300->context.screen)->caps->is_r500) {
278 fs =
279 (struct r3xx_fragment_shader*)CALLOC_STRUCT(r500_fragment_shader);
280 } else {
281 fs =
282 (struct r3xx_fragment_shader*)CALLOC_STRUCT(r300_fragment_shader);
283 }
284
285 /* Copy state directly into shader. */
286 fs->state = *shader;
287
288 tgsi_scan_shader(shader->tokens, &fs->info);
289
290 return (void*)fs;
291 }
292
293 /* Bind fragment shader state. */
294 static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
295 {
296 struct r300_context* r300 = r300_context(pipe);
297 struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader;
298
299 if (fs == NULL) {
300 r300->fs = NULL;
301 return;
302 } else if (!fs->translated) {
303 r300_translate_fragment_shader(r300, fs);
304 }
305
306 fs->translated = TRUE;
307 r300->fs = fs;
308
309 r300->dirty_state |= R300_NEW_FRAGMENT_SHADER;
310 }
311
312 /* Delete fragment shader state. */
313 static void r300_delete_fs_state(struct pipe_context* pipe, void* shader)
314 {
315 FREE(shader);
316 }
317
318 static void r300_set_polygon_stipple(struct pipe_context* pipe,
319 const struct pipe_poly_stipple* state)
320 {
321 /* XXX */
322 }
323
324 /* Create a new rasterizer state based on the CSO rasterizer state.
325 *
326 * This is a very large chunk of state, and covers most of the graphics
327 * backend (GB), geometry assembly (GA), and setup unit (SU) blocks.
328 *
329 * In a not entirely unironic sidenote, this state has nearly nothing to do
330 * with the actual block on the Radeon called the rasterizer (RS). */
331 static void* r300_create_rs_state(struct pipe_context* pipe,
332 const struct pipe_rasterizer_state* state)
333 {
334 struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
335
336 /* XXX this is part of HW TCL */
337 /* XXX endian control */
338 rs->vap_control_status = R300_VAP_TCL_BYPASS;
339
340 rs->point_size = pack_float_16_6x(state->point_size) |
341 (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
342
343 rs->point_minmax =
344 ((int)(state->point_size_min * 6.0) <<
345 R300_GA_POINT_MINMAX_MIN_SHIFT) |
346 ((int)(state->point_size_max * 6.0) <<
347 R300_GA_POINT_MINMAX_MAX_SHIFT);
348
349 rs->line_control = pack_float_16_6x(state->line_width) |
350 R300_GA_LINE_CNTL_END_TYPE_COMP;
351
352 /* Radeons don't think in "CW/CCW", they think in "front/back". */
353 if (state->front_winding == PIPE_WINDING_CW) {
354 rs->cull_mode = R300_FRONT_FACE_CW;
355
356 if (state->offset_cw) {
357 rs->polygon_offset_enable |= R300_FRONT_ENABLE;
358 }
359 if (state->offset_ccw) {
360 rs->polygon_offset_enable |= R300_BACK_ENABLE;
361 }
362 } else {
363 rs->cull_mode = R300_FRONT_FACE_CCW;
364
365 if (state->offset_ccw) {
366 rs->polygon_offset_enable |= R300_FRONT_ENABLE;
367 }
368 if (state->offset_cw) {
369 rs->polygon_offset_enable |= R300_BACK_ENABLE;
370 }
371 }
372 if (state->front_winding & state->cull_mode) {
373 rs->cull_mode |= R300_CULL_FRONT;
374 }
375 if (~(state->front_winding) & state->cull_mode) {
376 rs->cull_mode |= R300_CULL_BACK;
377 }
378
379 if (rs->polygon_offset_enable) {
380 rs->depth_offset_front = rs->depth_offset_back =
381 fui(state->offset_units);
382 rs->depth_scale_front = rs->depth_scale_back =
383 fui(state->offset_scale);
384 }
385
386 if (state->line_stipple_enable) {
387 rs->line_stipple_config =
388 R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE |
389 (fui((float)state->line_stipple_factor) &
390 R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK);
391 /* XXX this might need to be scaled up */
392 rs->line_stipple_value = state->line_stipple_pattern;
393 }
394
395 if (state->flatshade) {
396 rs->color_control = R300_SHADE_MODEL_FLAT;
397 } else {
398 rs->color_control = R300_SHADE_MODEL_SMOOTH;
399 }
400
401 rs->rs = *state;
402
403 return (void*)rs;
404 }
405
406 /* Bind rasterizer state. */
407 static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
408 {
409 struct r300_context* r300 = r300_context(pipe);
410 struct r300_rs_state* rs = (struct r300_rs_state*)state;
411
412 draw_set_rasterizer_state(r300->draw, &rs->rs);
413
414 r300->rs_state = rs;
415 r300->dirty_state |= R300_NEW_RASTERIZER;
416 }
417
418 /* Free rasterizer state. */
419 static void r300_delete_rs_state(struct pipe_context* pipe, void* state)
420 {
421 FREE(state);
422 }
423
424 static void*
425 r300_create_sampler_state(struct pipe_context* pipe,
426 const struct pipe_sampler_state* state)
427 {
428 struct r300_context* r300 = r300_context(pipe);
429 struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
430 int lod_bias;
431
432 sampler->filter0 |=
433 (r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) |
434 (r300_translate_wrap(state->wrap_t) << R300_TX_WRAP_T_SHIFT) |
435 (r300_translate_wrap(state->wrap_r) << R300_TX_WRAP_R_SHIFT);
436
437 sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter,
438 state->mag_img_filter,
439 state->min_mip_filter);
440
441 lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1);
442
443 sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
444
445 sampler->filter1 |= r300_anisotropy(state->max_anisotropy);
446
447 util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM,
448 &sampler->border_color);
449
450 /* R500-specific fixups and optimizations */
451 if (r300_screen(r300->context.screen)->caps->is_r500) {
452 sampler->filter1 |= R500_BORDER_FIX;
453 }
454
455 return (void*)sampler;
456 }
457
458 static void r300_bind_sampler_states(struct pipe_context* pipe,
459 unsigned count,
460 void** states)
461 {
462 struct r300_context* r300 = r300_context(pipe);
463 int i;
464
465 if (count > 8) {
466 return;
467 }
468
469 for (i = 0; i < count; i++) {
470 if (r300->sampler_states[i] != states[i]) {
471 r300->sampler_states[i] = (struct r300_sampler_state*)states[i];
472 r300->dirty_state |= (R300_NEW_SAMPLER << i);
473 }
474 }
475
476 r300->sampler_count = count;
477 }
478
479 static void r300_delete_sampler_state(struct pipe_context* pipe, void* state)
480 {
481 FREE(state);
482 }
483
484 static void r300_set_sampler_textures(struct pipe_context* pipe,
485 unsigned count,
486 struct pipe_texture** texture)
487 {
488 struct r300_context* r300 = r300_context(pipe);
489 int i;
490
491 /* XXX magic num */
492 if (count > 8) {
493 return;
494 }
495
496 for (i = 0; i < count; i++) {
497 if (r300->textures[i] != (struct r300_texture*)texture[i]) {
498 pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
499 texture[i]);
500 r300->dirty_state |= (R300_NEW_TEXTURE << i);
501 }
502 }
503
504 for (i = count; i < 8; i++) {
505 if (r300->textures[i]) {
506 pipe_texture_reference((struct pipe_texture**)&r300->textures[i],
507 NULL);
508 r300->dirty_state |= (R300_NEW_TEXTURE << i);
509 }
510 }
511
512 r300->texture_count = count;
513 }
514
515 static void r300_set_scissor_state(struct pipe_context* pipe,
516 const struct pipe_scissor_state* state)
517 {
518 struct r300_context* r300 = r300_context(pipe);
519 draw_flush(r300->draw);
520
521 if (r300_screen(r300->context.screen)->caps->is_r500) {
522 r300->scissor_state->scissor_top_left =
523 (state->minx << R300_SCISSORS_X_SHIFT) |
524 (state->miny << R300_SCISSORS_Y_SHIFT);
525 r300->scissor_state->scissor_bottom_right =
526 (state->maxx << R300_SCISSORS_X_SHIFT) |
527 (state->maxy << R300_SCISSORS_Y_SHIFT);
528 } else {
529 /* Offset of 1440 in non-R500 chipsets. */
530 r300->scissor_state->scissor_top_left =
531 ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) |
532 ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT);
533 r300->scissor_state->scissor_bottom_right =
534 ((state->maxx + 1440) << R300_SCISSORS_X_SHIFT) |
535 ((state->maxy + 1440) << R300_SCISSORS_Y_SHIFT);
536 }
537
538 r300->dirty_state |= R300_NEW_SCISSOR;
539 }
540
541 static void r300_set_viewport_state(struct pipe_context* pipe,
542 const struct pipe_viewport_state* state)
543 {
544 struct r300_context* r300 = r300_context(pipe);
545
546 r300->viewport_state->xscale = state->scale[0];
547 r300->viewport_state->yscale = state->scale[1];
548 r300->viewport_state->zscale = state->scale[2];
549
550 r300->viewport_state->xoffset = state->translate[0];
551 r300->viewport_state->yoffset = state->translate[1];
552 r300->viewport_state->zoffset = state->translate[2];
553
554 r300->viewport_state->vte_control = 0;
555 if (r300_screen(r300->context.screen)->caps->has_tcl) {
556 /* Do the transform in HW. */
557 r300->viewport_state->vte_control |=
558 R300_VPORT_X_SCALE_ENA | R300_VPORT_X_OFFSET_ENA |
559 R300_VPORT_Y_SCALE_ENA | R300_VPORT_Y_OFFSET_ENA |
560 R300_VPORT_Z_SCALE_ENA | R300_VPORT_Z_OFFSET_ENA;
561 } else {
562 /* Have Draw do the actual transform. */
563 draw_set_viewport_state(r300->draw, state);
564 }
565 }
566
567 static void r300_set_vertex_buffers(struct pipe_context* pipe,
568 unsigned count,
569 const struct pipe_vertex_buffer* buffers)
570 {
571 struct r300_context* r300 = r300_context(pipe);
572
573 memcpy(r300->vertex_buffers, buffers,
574 sizeof(struct pipe_vertex_buffer) * count);
575
576 r300->vertex_buffer_count = count;
577
578 draw_flush(r300->draw);
579 draw_set_vertex_buffers(r300->draw, count, buffers);
580 }
581
582 static void r300_set_vertex_elements(struct pipe_context* pipe,
583 unsigned count,
584 const struct pipe_vertex_element* elements)
585 {
586 struct r300_context* r300 = r300_context(pipe);
587 /* XXX Draw */
588 draw_flush(r300->draw);
589 draw_set_vertex_elements(r300->draw, count, elements);
590 }
591
592 static void* r300_create_vs_state(struct pipe_context* pipe,
593 const struct pipe_shader_state* state)
594 {
595 struct r300_context* context = r300_context(pipe);
596 tgsi_dump(state->tokens);
597 /* XXX handing this off to Draw for now */
598 return draw_create_vertex_shader(context->draw, state);
599 }
600
601 static void r300_bind_vs_state(struct pipe_context* pipe, void* state) {
602 struct r300_context* context = r300_context(pipe);
603 /* XXX handing this off to Draw for now */
604 draw_bind_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
605 }
606
607 static void r300_delete_vs_state(struct pipe_context* pipe, void* state)
608 {
609 struct r300_context* context = r300_context(pipe);
610 /* XXX handing this off to Draw for now */
611 draw_delete_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
612 }
613
614 void r300_init_state_functions(struct r300_context* r300)
615 {
616 r300->context.create_blend_state = r300_create_blend_state;
617 r300->context.bind_blend_state = r300_bind_blend_state;
618 r300->context.delete_blend_state = r300_delete_blend_state;
619
620 r300->context.set_blend_color = r300_set_blend_color;
621
622 r300->context.set_clip_state = r300_set_clip_state;
623
624 r300->context.set_constant_buffer = r300_set_constant_buffer;
625
626 r300->context.create_depth_stencil_alpha_state = r300_create_dsa_state;
627 r300->context.bind_depth_stencil_alpha_state = r300_bind_dsa_state;
628 r300->context.delete_depth_stencil_alpha_state = r300_delete_dsa_state;
629
630 r300->context.set_edgeflags = r300_set_edgeflags;
631
632 r300->context.set_framebuffer_state = r300_set_framebuffer_state;
633
634 r300->context.create_fs_state = r300_create_fs_state;
635 r300->context.bind_fs_state = r300_bind_fs_state;
636 r300->context.delete_fs_state = r300_delete_fs_state;
637
638 r300->context.set_polygon_stipple = r300_set_polygon_stipple;
639
640 r300->context.create_rasterizer_state = r300_create_rs_state;
641 r300->context.bind_rasterizer_state = r300_bind_rs_state;
642 r300->context.delete_rasterizer_state = r300_delete_rs_state;
643
644 r300->context.create_sampler_state = r300_create_sampler_state;
645 r300->context.bind_sampler_states = r300_bind_sampler_states;
646 r300->context.delete_sampler_state = r300_delete_sampler_state;
647
648 r300->context.set_sampler_textures = r300_set_sampler_textures;
649
650 r300->context.set_scissor_state = r300_set_scissor_state;
651
652 r300->context.set_viewport_state = r300_set_viewport_state;
653
654 r300->context.set_vertex_buffers = r300_set_vertex_buffers;
655 r300->context.set_vertex_elements = r300_set_vertex_elements;
656
657 r300->context.create_vs_state = r300_create_vs_state;
658 r300->context.bind_vs_state = r300_bind_vs_state;
659 r300->context.delete_vs_state = r300_delete_vs_state;
660 }