Lines Matching refs:r300
50 * Gallium state objects into semi-native r300 state objects. */
55 r300_mark_atom_dirty(r300, &(atom)); \
379 /* Neither fglrx nor classic r300 ever set this, regardless of dithering
441 struct r300_context* r300 = r300_context(pipe);
443 UPDATE_STATE(state, r300->blend_state);
460 * Setup both R300 and R500 registers, figure out later which one to write. */
464 struct r300_context* r300 = r300_context(pipe);
465 struct pipe_framebuffer_state *fb = r300->fb_state.state;
467 (struct r300_blend_color_state*)r300->blend_color_state.state;
508 if (r300->screen->caps.is_r500) {
537 r300_mark_atom_dirty(r300, &r300->blend_color_state);
543 struct r300_context* r300 = r300_context(pipe);
545 (struct r300_clip_state*)r300->clip_state.state;
548 if (r300->screen->caps.has_tcl) {
549 BEGIN_CB(clip->cb, r300->clip_state.size);
551 (r300->screen->caps.is_r500 ?
557 r300_mark_atom_dirty(r300, &r300->clip_state);
559 draw_set_clip_state(r300->draw, state);
708 static void r300_dsa_inject_stencilref(struct r300_context *r300)
711 (struct r300_dsa_state*)r300->dsa_state.state;
718 r300->stencil_ref.ref_value[0];
721 r300->stencil_ref.ref_value[1];
728 struct r300_context* r300 = r300_context(pipe);
734 UPDATE_STATE(state, r300->dsa_state);
736 r300_mark_atom_dirty(r300, &r300->hyperz_state); /* Will be updated before the emission. */
737 r300_dsa_inject_stencilref(r300);
750 struct r300_context* r300 = r300_context(pipe);
752 r300->stencil_ref = *sr;
754 r300_dsa_inject_stencilref(r300);
755 r300_mark_atom_dirty(r300, &r300->dsa_state);
758 static void r300_tex_set_tiling_flags(struct r300_context *r300,
766 r300->rws->buffer_set_tiling(tex->buf, r300->cs,
776 static void r300_fb_set_tiling_flags(struct r300_context *r300,
783 r300_tex_set_tiling_flags(r300,
788 r300_tex_set_tiling_flags(r300,
801 "r300: %s[%i] Dim: %ix%i, Firstlayer: %i, "
804 "r300: TEX: Macro: %s, Micro: %s, "
817 void r300_mark_fb_state_dirty(struct r300_context *r300,
820 struct pipe_framebuffer_state *state = r300->fb_state.state;
822 r300_mark_atom_dirty(r300, &r300->gpu_flush);
823 r300_mark_atom_dirty(r300, &r300->fb_state);
827 r300_mark_atom_dirty(r300, &r300->aa_state);
828 r300_mark_atom_dirty(r300, &r300->dsa_state); /* for AlphaRef */
829 r300_set_blend_color(&r300->context, r300->blend_color_state.state);
834 r300_mark_atom_dirty(r300, &r300->hyperz_state);
839 r300_mark_atom_dirty(r300, &r300->fb_state_pipelined);
843 r300->fb_state.size = 2 + (8 * state->nr_cbufs);
845 if (r300->cbzb_clear) {
846 r300->fb_state.size += 10;
848 r300->fb_state.size += 10;
849 if (r300->hyperz_enabled)
850 r300->fb_state.size += 8;
852 r300->fb_state.size += 10;
862 struct r300_context* r300
863 struct r300_aa_state *aa = (struct r300_aa_state*)r300->aa_state.state;
864 struct pipe_framebuffer_state *old_state = r300->fb_state.state;
869 if (r300->screen->caps.is_r500) {
871 } else if (r300->screen->caps.is_r400) {
878 fprintf(stderr, "r300: Implementation error: Render targets are too "
883 if (old_state->zsbuf && r300->zmask_in_use && !r300->locked_zbuffer) {
888 r300_decompress_zmask(r300);
889 r300->hiz_in_use = FALSE;
893 pipe_surface_reference(&r300->locked_zbuffer, old_state->zsbuf);
895 } else if (r300->locked_zbuffer) {
898 if (!pipe_surface_equal(r300->locked_zbuffer, state->zsbuf)) {
901 r300_decompress_zmask_locked_unsafe(r300);
902 r300->hiz_in_use = FALSE;
909 assert(state->zsbuf || (r300->locked_zbuffer && !unlock_zbuffer) || !r300->zmask_in_use);
912 r300_mark_atom_dirty(r300, &r300->blend_state);
915 r300_set_blend_color(pipe, &((struct r300_blend_color_state*)r300->blend_color_state.state)->state);
919 r300_mark_atom_dirty(r300, &r300->dsa_state);
922 if (r300->screen->info.drm_minor < 12) {
926 r300_fb_set_tiling_flags(r300, state);
929 util_copy_framebuffer_state(r300->fb_state.state, state);
932 pipe_surface_reference(&r300->locked_zbuffer, NULL);
935 r300_mark_fb_state_dirty(r300, R300_CHANGED_FB_STATE);
948 if (r300->zbuffer_bpp != zbuffer_bpp) {
949 r300->zbuffer_bpp = zbuffer_bpp;
951 if (r300->polygon_offset_enabled)
952 r300_mark_atom_dirty(r300, &r300->rs_state);
978 if (DBG_ON(r300, DBG_FB)) {
979 fprintf(stderr, "r300: set_framebuffer_state:\n");
1004 void r300_mark_fs_code_dirty(struct r300_context *r300)
1006 struct r300_fragment_shader* fs = r300_fs(r300);
1008 r300_mark_atom_dirty(r300, &r300->fs);
1009 r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
1010 r300_mark_atom_dirty(r300, &r300->fs_constants);
1011 r300->fs.size = fs->shader->cb_code_size;
1013 if (r300->screen->caps.is_r500) {
1014 r300->fs_rc_constant_state.size = fs->shader->rc_state_count * 7;
1015 r300->fs_constants.size = fs->shader->externals_count * 4 + 3;
1017 r300->fs_rc_constant_state.size = fs->shader->rc_state_count * 5;
1018 r300->fs_constants.size = fs->shader->externals_count * 4 + 1;
1021 ((struct r300_constant_buffer*)r300->fs_constants.state)->remap_table =
1028 struct r300_context* r300 = r300_context(pipe);
1032 r300->fs.state = NULL;
1036 r300->fs.state = fs;
1037 r300->fs_status = FRAGMENT_SHADER_DIRTY;
1039 r300_mark_atom_dirty(r300, &r300->rs_block_state); /* Will be updated before the emission. */
1291 struct r300_context* r300 = r300_context(pipe);
1293 int last_sprite_coord_enable = r300->sprite_coord_enable;
1294 boolean last_two_sided_color = r300->two_sided_color;
1296 if (r300->draw && rs) {
1297 draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
1301 r300->polygon_offset_enabled = rs->polygon_offset_enable;
1302 r300->sprite_coord_enable = rs->rs.sprite_coord_enable;
1303 r300->two_sided_color = rs->rs.light_twoside;
1305 r300->polygon_offset_enabled = FALSE;
1306 r300->sprite_coord_enable = 0;
1307 r300->two_sided_color = FALSE;
1310 UPDATE_STATE(state, r300->rs_state);
1311 r300->rs_state.size = RS_STATE_MAIN_SIZE + (r300->polygon_offset_enabled ? 5 : 0);
1313 if (last_sprite_coord_enable != r300->sprite_coord_enable ||
1314 last_two_sided_color != r300->two_sided_color) {
1315 r300_mark_atom_dirty(r300, &r300->rs_block_state);
1329 struct r300_context* r300 = r300_context(pipe);
1331 boolean is_r500 = r300->screen->caps.is_r500;
1336 /* r300 doesn't handle CLAMP and MIRROR_CLAMP correctly when either MAG
1372 /* Unfortunately, r300-r500 don't support floating-point mipmap lods. */
1385 if (DBG_ON(r300, DBG_ANISOHQ) && is_r500) {
1390 if (r300->screen->caps.is_r500) {
1401 struct r300_context* r300 = r300_context(pipe);
1403 (struct r300_textures_state*)r300->textures_state.state;
1404 unsigned tex_units = r300->screen->caps.num_tex_units;
1413 r300_mark_atom_dirty(r300, &r300->textures_state);
1456 struct r300_context* r300 = r300_context(pipe);
1458 (struct r300_textures_state*)r300->textures_state.state;
1461 unsigned tex_units = r300->screen->caps.num_tex_units;
1490 r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
1508 r300_mark_atom_dirty(r300, &r300->textures_state);
1511 r300_mark_atom_dirty(r300, &r300->texture_cache_inval);
1549 fprintf(stderr, "r300: Ooops. Got unsupported format %s in %s.\n",
1589 struct r300_context* r300 = r300_context(pipe);
1591 memcpy(r300->scissor_state.state, state,
1594 r300_mark_atom_dirty(r300, &r300->scissor_state);
1600 struct r300_context* r300 = r300_context(pipe);
1602 (struct r300_viewport_state*)r300->viewport_state.state;
1604 r300->viewport = *state;
1606 if (r300->draw) {
1607 draw_set_viewport_state(r300->draw, state);
1640 r300_mark_atom_dirty(r300, &r300->viewport_state);
1641 if (r300->fs.state && r300_fs(r300)->shader &&
1642 r300_fs(r300)->shader->inputs.wpos != ATTR_UNUSED) {
1643 r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
1651 struct r300_context* r300 = r300_context(pipe);
1655 buffers = &r300->dummy_vb;
1659 util_copy_vertex_buffers(r300->vertex_buffer,
1660 &r300->nr_vertex_buffers,
1663 r300->vertex_arrays_dirty = TRUE;
1670 struct r300_context* r300 = r300_context(pipe);
1673 util_copy_vertex_buffers(r300->vertex_buffer,
1674 &r300->nr_vertex_buffers,
1676 draw_set_vertex_buffers(r300->draw, count, buffers);
1680 draw_set_mapped_vertex_buffer(r300->draw, i,
1683 draw_set_mapped_vertex_buffer(r300->draw, i,
1692 struct r300_context* r300 = r300_context(pipe);
1695 pipe_resource_reference(&r300->index_buffer.buffer, ib->buffer);
1696 memcpy(&r300->index_buffer, ib, sizeof(*ib));
1698 pipe_resource_reference(&r300->index_buffer.buffer, NULL);
1705 struct r300_context* r300 = r300_context(pipe);
1714 draw_set_indexes(r300->draw,
1736 fprintf(stderr, "r300: Bad vertex format %s.\n",
1772 /* R300 Programmable Stream Control (PSC) doesn't support 0 vertex elements. */
1778 fprintf(stderr, "r300: More than 16 vertex elements are not supported,"
1808 struct r300_context *r300 = r300_context(pipe);
1815 r300->velems = velems;
1817 if (r300->draw) {
1818 draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
1822 UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
1823 r300->vertex_stream_state.size = (1 + velems->vertex_stream.count) * 2;
1824 r300->vertex_arrays_dirty = TRUE;
1835 struct r300_context* r300 = r300_context(pipe);
1842 if (r300->screen->caps.has_tcl) {
1843 r300_init_vs_outputs(r300, vs);
1844 r300_translate_vertex_shader(r300, vs);
1846 r300_draw_init_vertex_shader(r300, vs);
1854 struct r300_context* r300 = r300_context(pipe);
1858 r300->vs_state.state = NULL;
1861 if (vs == r300->vs_state.state) {
1864 r300->vs_state.state = vs;
1867 r300_mark_atom_dirty(r300, &r300->rs_block_state); /* Will be updated before the emission. */
1869 if (r300->screen->caps.has_tcl) {
1870 unsigned fc_op_dwords = r300->screen->caps.is_r500 ? 3 : 2;
1871 r300_mark_atom_dirty(r300, &r300->vs_state);
1872 r300->vs_state.size = vs->code.length + 9 +
1875 r300_mark_atom_dirty(r300, &r300->vs_constants);
1876 r300->vs_constants.size =
1881 ((struct r300_constant_buffer*)r300->vs_constants.state)->remap_table =
1884 r300_mark_atom_dirty(r300, &r300->pvs_flush);
1886 draw_bind_vertex_shader(r300->draw,
1893 struct r300_context* r300 = r300_context(pipe);
1896 if (r300->screen->caps.has_tcl) {
1901 draw_delete_vertex_shader(r300->draw,
1913 struct r300_context* r300 = r300_context(pipe);
1922 cbuf = (struct r300_constant_buffer*)r300->vs_constants.state;
1925 cbuf = (struct r300_constant_buffer*)r300->fs_constants.state;
1944 (shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) {
1949 if (r300->screen->caps.has_tcl) {
1951 (struct r300_vertex_shader*)r300->vs_state.state;
1958 cbuf->buffer_base = r300->vs_const_base;
1959 r300->vs_const_base += vs->code.constants.Count;
1960 if (r300->vs_const_base > R500_MAX_PVS_CONST_VECS) {
1961 r300->vs_const_base = vs->code.constants.Count;
1963 r300_mark_atom_dirty(r300, &r300->pvs_flush);
1965 r300_mark_atom_dirty(r300, &r300->vs_constants);
1966 } else if (r300->draw) {
1967 draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
1971 r300_mark_atom_dirty(r300, &r300->fs_constants);
1977 struct r300_context *r300 = r300_context(pipe);
1979 r300_mark_atom_dirty(r300, &r300->gpu_flush);
1980 r300_mark_atom_dirty(r300, &r300->texture_cache_inval);
1983 void r300_init_state_functions(struct r300_context* r300)
1985 r300->context.create_blend_state = r300_create_blend_state;
1986 r300->context.bind_blend_state = r300_bind_blend_state;
1987 r300->context.delete_blend_state = r300_delete_blend_state;
1989 r300->context.set_blend_color = r300_set_blend_color;
1991 r300->context.set_clip_state = r300_set_clip_state;
1992 r300->context.set_sample_mask = r300_set_sample_mask;
1994 r300->context.set_constant_buffer = r300_set_constant_buffer;
1996 r300->context.create_depth_stencil_alpha_state = r300_create_dsa_state;
1997 r300->context.bind_depth_stencil_alpha_state = r300_bind_dsa_state;
1998 r300->context.delete_depth_stencil_alpha_state = r300_delete_dsa_state;
2000 r300->context.set_stencil_ref = r300_set_stencil_ref;
2002 r300->context.set_framebuffer_state = r300_set_framebuffer_state;
2004 r300->context.create_fs_state = r300_create_fs_state;
2005 r300->context.bind_fs_state = r300_bind_fs_state;
2006 r300->context.delete_fs_state = r300_delete_fs_state;
2008 r300->context.set_polygon_stipple = r300_set_polygon_stipple;
2010 r300->context.create_rasterizer_state = r300_create_rs_state;
2011 r300->context.bind_rasterizer_state = r300_bind_rs_state;
2012 r300->context.delete_rasterizer_state = r300_delete_rs_state;
2014 r300->context.create_sampler_state = r300_create_sampler_state;
2015 r300->context.bind_fragment_sampler_states = r300_bind_sampler_states;
2016 r300->context.bind_vertex_sampler_states = r300_lacks_vertex_textures;
2017 r300->context.delete_sampler_state = r300_delete_sampler_state;
2019 r300->context.set_fragment_sampler_views = r300_set_fragment_sampler_views;
2020 r300->context.create_sampler_view = r300_create_sampler_view;
2021 r300->context.sampler_view_destroy = r300_sampler_view_destroy;
2023 r300->context.set_scissor_state = r300_set_scissor_state;
2025 r300->context.set_viewport_state = r300_set_viewport_state;
2027 if (r300->screen->caps.has_tcl) {
2028 r300->context.set_vertex_buffers = r300_set_vertex_buffers_hwtcl;
2029 r300->context.set_index_buffer = r300_set_index_buffer_hwtcl;
2031 r300->context.set_vertex_buffers = r300_set_vertex_buffers_swtcl;
2032 r300->context.set_index_buffer = r300_set_index_buffer_swtcl;
2035 r300->context.create_vertex_elements_state = r300_create_vertex_elements_state;
2036 r300->context.bind_vertex_elements_state = r300_bind_vertex_elements_state;
2037 r300->context.delete_vertex_elements_state = r300_delete_vertex_elements_state;
2039 r300->context.create_vs_state = r300_create_vs_state;
2040 r300->context.bind_vs_state = r300_bind_vs_state;
2041 r300->context.delete_vs_state = r300_delete_vs_state;
2043 r300->context.texture_barrier = r300_texture_barrier;