Home | History | Annotate | Download | only in r300

Lines Matching refs:state

50 /* r300_state: Functions used to intialize state context by translating
51 * Gallium state objects into semi-native r300 state objects. */
54 if (cso != atom.state) { \
55 atom.state = cso; \
63 * SRC_ALPHA == 0, and the following state is set, the colorbuffer
84 * SRC_ALPHA == 1, and the following state is set, the colorbuffer
103 * SRC_COLOR == (0,0,0), and the following state is set, the colorbuffer
118 * SRC_COLOR == (1,1,1), and the following state is set, the colorbuffer
133 * SRC_ALPHA_COLOR == (0,0,0,0), and the following state is set,
156 * SRC_ALPHA_COLOR == (1,1,1,1), and the following state is set,
336 /* Create a new blend state based on the CSO blend state.
340 const struct pipe_blend_state* state)
356 const unsigned eqRGB = state->rt[0].rgb_func;
357 const unsigned srcRGB = state->rt[0].rgb_src_factor;
358 const unsigned dstRGB = state->rt[0].rgb_dst_factor;
360 const unsigned eqA = state->rt[0].alpha_func;
361 const unsigned srcA = state->rt[0].alpha_src_factor;
362 const unsigned dstA = state->rt[0].alpha_dst_factor;
368 blend->state = *state;
390 if (state->rt[0].blend_enable) {
454 if (state->logicop_enable) {
456 (state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT;
460 * state. Since it's an optional implementation detail, we can leave it
465 if (state->dither) {
492 OUT_CB(func[i](state->rt[0].colormask));
504 OUT_CB(rgba_cmask(state->rt[0].colormask));
514 OUT_CB(rgba_cmask(state->rt[0].colormask));
531 /* Bind blend state. */
533 void* state)
536 struct r300_blend_state *blend = (struct r300_blend_state*)state;
540 UPDATE_STATE(state, r300->blend_state);
545 r300->alpha_to_one = blend->state.alpha_to_one;
546 r300->alpha_to_coverage = blend->state.alpha_to_coverage;
559 /* Free blend state. */
561 void* state)
563 FREE(state);
578 struct pipe_framebuffer_state *fb = r300->fb_state.state;
579 struct r300_blend_color_state *state =
580 (struct r300_blend_color_state*)r300->blend_color_state.state;
586 state->state = *color; /* Save it, so that we can reuse it in set_fb_state */
624 BEGIN_CB(state->cb, 3);
648 BEGIN_CB(state->cb, 2);
657 const struct pipe_clip_state* state)
661 (struct r300_clip_state*)r300->clip_state.state;
670 OUT_CB_TABLE(state->ucp, 6 * 4);
675 draw_set_clip_state(r300->draw, state);
679 /* Create a new depth, stencil, and alpha state based on the CSO dsa state.
685 const struct pipe_depth_stencil_alpha_state* state)
696 dsa->dsa = *state;
699 if (state->depth.writemask) {
703 if (state->depth.enabled) {
707 (r300_translate_depth_stencil_function(state->depth.func) <<
712 if (state->stencil[0].enabled) {
715 (r300_translate_depth_stencil_function(state->stencil[0].func) <<
717 (r300_translate_stencil_op(state->stencil[0].fail_op) <<
719 (r300_translate_stencil_op(state->stencil[0].zpass_op) <<
721 (r300_translate_stencil_op(state->stencil[0].zfail_op) <<
725 (state->stencil[0].valuemask << R300_STENCILMASK_SHIFT) |
726 (state->stencil[0].writemask << R300_STENCILWRITEMASK_SHIFT);
728 if (state->stencil[1].enabled) {
733 (r300_translate_depth_stencil_function(state->stencil[1].func) <<
735 (r300_translate_stencil_op(state->stencil[1].fail_op) <<
737 (r300_translate_stencil_op(state->stencil[1].zpass_op) <<
739 (r300_translate_stencil_op(state->stencil[1].zfail_op) <<
743 (state->stencil[1].valuemask << R300_STENCILMASK_SHIFT) |
744 (state->stencil[1].writemask << R300_STENCILWRITEMASK_SHIFT);
750 (state->stencil[0].valuemask != state->stencil[1].valuemask ||
751 state->stencil[0].writemask != state->stencil[1].writemask);
757 if (state->alpha.enabled) {
759 r300_translate_alpha_function(state->alpha.func) |
762 dsa->alpha_function |= float_to_ubyte(state->alpha.ref_value);
763 alpha_value_fp16 = util_float_to_half(state->alpha.ref_value);
790 (struct r300_dsa_state*)r300->dsa_state.state;
803 /* Bind DSA state. */
805 void* state)
809 if (!state) {
813 UPDATE_STATE(state, r300->dsa_state);
819 /* Free DSA state. */
821 void* state)
823 FREE(state);
863 struct pipe_framebuffer_state *state = r300->fb_state.state;
872 r300_set_blend_color(&r300->context, r300->blend_color_state.state);
886 r300->fb_state.size = 2 + (8 * state->nr_cbufs);
890 else if (state->zsbuf) {
908 const struct pipe_framebuffer_state* state)
911 struct r300_aa_state *aa = (struct r300_aa_state*)r300->aa_state.state;
912 struct pipe_framebuffer_state *current_state = r300->fb_state.state;
925 if (state->width > max_width || state->height > max_height) {
927 "big in %s, refusing to bind framebuffer state!\n", __FUNCTION__);
933 if (state->zsbuf) {
934 if (!pipe_surface_equal(current_state->zsbuf, state->zsbuf)) {
945 if (state->zsbuf) {
946 if (!pipe_surface_equal(r300->locked_zbuffer, state->zsbuf)) {
957 assert(state->zsbuf || (r300->locked_zbuffer && !unlock_zbuffer) || !r300->zmask_in_use);
960 if (!!current_state->zsbuf != !!state->zsbuf) {
964 util_copy_framebuffer_state(r300->fb_state.state, state);
972 state->nr_cbufs == 1 && state->cbufs[0] &&
973 r300->screen->cmask_resource == state->cbufs[0]->texture;
979 r300_set_blend_color(pipe, &((struct r300_blend_color_state*)r300->blend_color_state.state)->state);
987 if (state->zsbuf) {
988 switch (util_format_get_blocksize(state->zsbuf->format)) {
1006 r300->num_samples = util_framebuffer_get_num_samples(state);
1030 for (i = 0; i < state->nr_cbufs; i++) {
1031 if (state->cbufs[i])
1032 r300_print_fb_surf_info(state->cbufs[i], i, "CB");
1034 if (state->zsbuf) {
1035 r300_print_fb_surf_info(state->zsbuf, 0, "ZB");
1040 /* Create fragment shader state. */
1048 /* Copy state directly into shader. */
1049 fs->state = *shader;
1050 fs->state.tokens = tgsi_dup_tokens(shader->tokens);
1072 ((struct r300_constant_buffer*)r300->fs_constants.state)->remap_table =
1076 /* Bind fragment shader state. */
1083 r300->fs.state = NULL;
1087 r300->fs.state = fs;
1093 /* Delete fragment shader state. */
1106 FREE((void*)fs->state.tokens);
1111 const struct pipe_poly_stipple* state)
1115 /* Create a new rasterizer state based on the CSO rasterizer state.
1117 * This is a very large chunk of state, and covers most of the graphics
1120 * In a not entirely unironic sidenote, this state has nearly nothing to do
1123 const struct pipe_rasterizer_state* state)
1147 /* Copy rasterizer state. */
1148 rs->rs = *state;
1149 rs->rs_draw = *state;
1151 rs->rs.sprite_coord_enable = state->point_quad_rasterization *
1152 state->sprite_coord_enable;
1174 pack_float_16_6x(state->point_size) |
1175 (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
1178 if (state->point_size_per_vertex) {
1181 float min_psiz = util_get_min_point_size(state);
1190 float psiz = state->point_size;
1197 line_control = pack_float_16_6x(state->line_width) |
1202 if (state->fill_front != PIPE_POLYGON_MODE_FILL ||
1203 state->fill_back != PIPE_POLYGON_MODE_FILL) {
1208 if (state->front_ccw)
1215 if (util_get_offset(state, state->fill_front)) {
1218 if (util_get_offset(state, state->fill_back)) {
1227 r300_translate_polygon_mode_front(state->fill_front);
1229 r300_translate_polygon_mode_back(state->fill_back);
1232 if (state->cull_face & PIPE_FACE_FRONT) {
1235 if (state->cull_face & PIPE_FACE_BACK) {
1239 if (state->line_stipple_enable) {
1242 (fui((float)state->line_stipple_factor) &
1245 line_stipple_value = state->line_stipple_pattern;
1251 if (state->flatshade) {
1257 clip_rule = state->scissor ? 0xAAAA : 0xFFFF;
1261 switch (state->sprite_coord_mode) {
1274 vap_clip_cntl = (state->clip_plane_enable & 63) |
1312 state->offset_scale * 12;
1313 float offset = state->offset_units * 4;
1323 offset = state->offset_units * 2;
1337 /* Bind rasterizer state. */
1338 static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
1341 struct r300_rs_state* rs = (struct r300_rs_state*)state;
1349 draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
1368 UPDATE_STATE(state, r300->rs_state);
1393 /* Free rasterizer state. */
1394 static void r300_delete_rs_state(struct pipe_context* pipe, void* state)
1396 FREE(state);
1401 const struct pipe_sampler_state* state)
1408 sampler->state = *state;
1413 if (sampler->state.min_img_filter == PIPE_TEX_FILTER_NEAREST ||
1414 sampler->state.mag_img_filter == PIPE_TEX_FILTER_NEAREST) {
1416 if (sampler->state.wrap_s == PIPE_TEX_WRAP_CLAMP)
1417 sampler->state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
1418 else if (sampler->state.wrap_s == PIPE_TEX_WRAP_MIRROR_CLAMP)
1419 sampler->state.wrap_s = PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE;
1422 if (sampler->state.wrap_t == PIPE_TEX_WRAP_CLAMP)
1423 sampler->state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
1424 else if (sampler->state.wrap_t == PIPE_TEX_WRAP_MIRROR_CLAMP)
1425 sampler->state.wrap_t = PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE;
1428 if (sampler->state.wrap_r == PIPE_TEX_WRAP_CLAMP)
1429 sampler->state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
1430 else if (sampler->state.wrap_r == PIPE_TEX_WRAP_MIRROR_CLAMP)
1431 sampler->state.wrap_r = PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE;
1435 (r300_translate_wrap(sampler->state.wrap_s) << R300_TX_WRAP_S_SHIFT) |
1436 (r300_translate_wrap(sampler->state.wrap_t) << R300_TX_WRAP_T_SHIFT) |
1437 (r300_translate_wrap(sampler->state.wrap_r) << R300_TX_WRAP_R_SHIFT);
1439 sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter,
1440 state->mag_img_filter,
1441 state->min_mip_filter,
1442 state->max_anisotropy > 1);
1444 sampler->filter0 |= r300_anisotropy(state->max_anisotropy);
1448 sampler->min_lod = (unsigned)MAX2(state->min_lod, 0);
1449 sampler->max_lod = (unsigned)MAX2(ceilf(state->max_lod), 0);
1451 lod_bias = CLAMP((int)(state->lod_bias * 32 + 1), -(1 << 9), (1 << 9) - 1);
1460 sampler->filter1 |= r500_anisotropy(state->max_anisotropy);
1477 struct r300_textures_state* state =
1478 (struct r300_textures_state*)r300->textures_state.state;
1489 memcpy(state->sampler_states, states, sizeof(void*) * count);
1490 state->sampler_state_count = count;
1495 static void r300_delete_sampler_state(struct pipe_context* pipe, void* state)
1497 FREE(state);
1531 struct r300_textures_state* state =
1532 (struct r300_textures_state*)r300->textures_state.state;
1555 (struct pipe_sampler_view**)&state->sampler_views[i],
1572 state->sampler_views[i]->texcache_region =
1578 if (state->sampler_views[i]) {
1580 (struct pipe_sampler_view**)&state->sampler_views[i],
1585 state->sampler_view_count = count;
1670 *((unsigned*)r300->sample_mask.state) = mask;
1678 const struct pipe_scissor_state* state)
1682 memcpy(r300->scissor_state.state, state,
1691 const struct pipe_viewport_state* state)
1695 (struct r300_viewport_state*)r300->viewport_state.state;
1697 r300->viewport = *state;
1700 draw_set_viewport_states(r300->draw, start_slot, num_viewports, state);
1708 if (state->scale[0] != 1.0f) {
1709 viewport->xscale = state->scale[0];
1712 if (state->scale[1] != 1.0f) {
1713 viewport->yscale = state->scale[1];
1716 if (state->scale[2] != 1.0f) {
1717 viewport->zscale = state->scale[2];
1720 if (state->translate[0] != 0.0f) {
1721 viewport->xoffset = state->translate[0];
1724 if (state->translate[1] != 0.0f) {
1725 viewport->yoffset = state->translate[1];
1728 if (state->translate[2] != 0.0f) {
1729 viewport->zoffset = state->translate[2];
1734 if (r300->fs.state && r300_fs(r300)->shader &&
1903 void *state)
1906 struct r300_vertex_element_state *velems = state;
1924 static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
1926 FREE(state);
1935 /* Copy state directly into shader. */
1936 vs->state = *shader;
1937 vs->state.tokens = tgsi_dup_tokens(shader->tokens);
1955 r300->vs_state.state = NULL;
1958 if (vs == r300->vs_state.state) {
1961 r300->vs_state.state = vs;
1978 ((struct r300_constant_buffer*)r300->vs_constants.state)->remap_table =
2001 FREE((void*)vs->state.tokens);
2018 cbuf = (struct r300_constant_buffer*)r300->vs_constants.state;
2021 cbuf = (struct r300_constant_buffer*)r300->fs_constants.state;
2047 (struct r300_vertex_shader*)r300->vs_state.state;