Lines Matching refs:r300
71 static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300, in r300_provoking_vertex_fixes() argument
74 struct r300_rs_state* rs = (struct r300_rs_state*)r300->rs_state.state; in r300_provoking_vertex_fixes()
116 void r500_emit_index_bias(struct r300_context *r300, int index_bias) in r500_emit_index_bias() argument
118 CS_LOCALS(r300); in r500_emit_index_bias()
126 static void r300_emit_draw_init(struct r300_context *r300, unsigned mode, in r300_emit_draw_init() argument
129 CS_LOCALS(r300); in r300_emit_draw_init()
135 r300_provoking_vertex_fixes(r300, mode)); in r300_emit_draw_init()
148 static void r300_split_index_bias(struct r300_context *r300, int index_bias, in r300_split_index_bias() argument
151 struct pipe_vertex_buffer *vb, *vbufs = r300->vertex_buffer; in r300_split_index_bias()
152 struct pipe_vertex_element *velem = r300->velems->velem; in r300_split_index_bias()
161 for (i = 0; i < r300->velems->count; i++) { in r300_split_index_bias()
193 static boolean r300_reserve_cs_dwords(struct r300_context *r300, in r300_reserve_cs_dwords() argument
204 cs_dwords += r300_get_num_dirty_dwords(r300); in r300_reserve_cs_dwords()
206 if (r300->screen->caps.is_r500) in r300_reserve_cs_dwords()
215 cs_dwords += r300_get_num_cs_end_dwords(r300); in r300_reserve_cs_dwords()
218 if (!r300->rws->cs_check_space(r300->cs, cs_dwords, false)) { in r300_reserve_cs_dwords()
219 r300_flush(&r300->context, PIPE_FLUSH_ASYNC, NULL); in r300_reserve_cs_dwords()
236 static boolean r300_emit_states(struct r300_context *r300, in r300_emit_states() argument
250 if (!r300_emit_buffer_validate(r300, validate_vbos, in r300_emit_states()
259 r300_emit_dirty_state(r300); in r300_emit_states()
261 if (r300->screen->caps.is_r500) { in r300_emit_states()
262 if (r300->screen->caps.has_tcl) in r300_emit_states()
263 r500_emit_index_bias(r300, index_bias); in r300_emit_states()
265 r500_emit_index_bias(r300, 0); in r300_emit_states()
269 (r300->vertex_arrays_dirty || in r300_emit_states()
270 r300->vertex_arrays_indexed != indexed || in r300_emit_states()
271 r300->vertex_arrays_offset != buffer_offset || in r300_emit_states()
272 r300->vertex_arrays_instance_id != instance_id)) { in r300_emit_states()
273 r300_emit_vertex_arrays(r300, buffer_offset, indexed, instance_id); in r300_emit_states()
275 r300->vertex_arrays_dirty = FALSE; in r300_emit_states()
276 r300->vertex_arrays_indexed = indexed; in r300_emit_states()
277 r300->vertex_arrays_offset = buffer_offset; in r300_emit_states()
278 r300->vertex_arrays_instance_id = instance_id; in r300_emit_states()
282 r300_emit_vertex_arrays_swtcl(r300, indexed); in r300_emit_states()
299 static boolean r300_prepare_for_rendering(struct r300_context *r300, in r300_prepare_for_rendering() argument
308 if (r300_reserve_cs_dwords(r300, flags, cs_dwords)) in r300_prepare_for_rendering()
311 return r300_emit_states(r300, flags, index_buffer, buffer_offset, in r300_prepare_for_rendering()
315 static boolean immd_is_good_idea(struct r300_context *r300, in immd_is_good_idea() argument
318 if (DBG_ON(r300, DBG_NO_IMMD)) { in immd_is_good_idea()
322 if (count * r300->velems->vertex_size_dwords > IMMD_DWORDS) { in immd_is_good_idea()
335 static void r300_draw_arrays_immediate(struct r300_context *r300, in r300_draw_arrays_immediate() argument
340 unsigned vertex_element_count = r300->velems->count; in r300_draw_arrays_immediate()
344 unsigned vertex_size = r300->velems->vertex_size_dwords; in r300_draw_arrays_immediate()
360 CS_LOCALS(r300); in r300_draw_arrays_immediate()
362 if (!r300_prepare_for_rendering(r300, PREP_EMIT_STATES, NULL, dwords, 0, 0, -1)) in r300_draw_arrays_immediate()
367 velem = &r300->velems->velem[i]; in r300_draw_arrays_immediate()
368 size[i] = r300->velems->format_size[i] / 4; in r300_draw_arrays_immediate()
370 vbuf = &r300->vertex_buffer[vbi]; in r300_draw_arrays_immediate()
375 map[vbi] = (uint32_t*)r300->rws->buffer_map( in r300_draw_arrays_immediate()
377 r300->cs, PIPE_MAP_READ | PIPE_MAP_UNSYNCHRONIZED); in r300_draw_arrays_immediate()
383 r300_emit_draw_init(r300, info->mode, info->count-1); in r300_draw_arrays_immediate()
400 static void r300_emit_draw_arrays(struct r300_context *r300, in r300_emit_draw_arrays() argument
405 CS_LOCALS(r300); in r300_emit_draw_arrays()
413 r300_emit_draw_init(r300, mode, count-1); in r300_emit_draw_arrays()
426 static void r300_emit_draw_elements(struct r300_context *r300, in r300_emit_draw_elements() argument
437 CS_LOCALS(r300); in r300_emit_draw_elements()
445 DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, max %u\n", in r300_emit_draw_elements()
448 r300_emit_draw_init(r300, mode, max_index); in r300_emit_draw_elements()
498 static void r300_draw_elements_immediate(struct r300_context *r300, in r300_draw_elements_immediate() argument
507 CS_LOCALS(r300); in r300_draw_elements_immediate()
510 if (!r300_prepare_for_rendering(r300, in r300_draw_elements_immediate()
515 r300_emit_draw_init(r300, info->mode, info->max_index); in r300_draw_elements_immediate()
528 if (info->index_bias && !r300->screen->caps.is_r500) { in r300_draw_elements_immediate()
552 if (info->index_bias && !r300->screen->caps.is_r500) { in r300_draw_elements_immediate()
572 if (info->index_bias && !r300->screen->caps.is_r500) { in r300_draw_elements_immediate()
583 static void r300_draw_elements(struct r300_context *r300, in r300_draw_elements() argument
593 boolean alt_num_verts = r300->screen->caps.is_r500 && in r300_draw_elements()
599 if (info->index_bias && !r300->screen->caps.is_r500) { in r300_draw_elements()
600 r300_split_index_bias(r300, info->index_bias, &buffer_offset, in r300_draw_elements()
604 r300_translate_index_buffer(r300, info, &indexBuffer, in r300_draw_elements()
610 uint16_t *ptr = r300->rws->buffer_map(r300_resource(orgIndexBuffer)->buf, in r300_draw_elements()
611 r300->cs, in r300_draw_elements()
621 r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, in r300_draw_elements()
626 r300_upload_index_buffer(r300, &indexBuffer, indexSize, in r300_draw_elements()
632 if (!r300_prepare_for_rendering(r300, in r300_draw_elements()
639 r300_emit_draw_elements(r300, indexBuffer, indexSize, in r300_draw_elements()
650 r300_emit_draw_elements(r300, indexBuffer, indexSize, in r300_draw_elements()
659 if (!r300_prepare_for_rendering(r300, in r300_draw_elements()
674 static void r300_draw_arrays(struct r300_context *r300, in r300_draw_arrays() argument
678 boolean alt_num_verts = r300->screen->caps.is_r500 && in r300_draw_arrays()
685 if (!r300_prepare_for_rendering(r300, in r300_draw_arrays()
691 r300_emit_draw_arrays(r300, info->mode, count); in r300_draw_arrays()
699 r300_emit_draw_arrays(r300, info->mode, short_count); in r300_draw_arrays()
706 if (!r300_prepare_for_rendering(r300, in r300_draw_arrays()
715 static void r300_draw_arrays_instanced(struct r300_context *r300, in r300_draw_arrays_instanced() argument
721 r300_draw_arrays(r300, info, i); in r300_draw_arrays_instanced()
724 static void r300_draw_elements_instanced(struct r300_context *r300, in r300_draw_elements_instanced() argument
730 r300_draw_elements(r300, info, i); in r300_draw_elements_instanced()
733 static unsigned r300_max_vertex_count(struct r300_context *r300) in r300_max_vertex_count() argument
735 unsigned i, nr = r300->velems->count; in r300_max_vertex_count()
736 struct pipe_vertex_element *velems = r300->velems->velem; in r300_max_vertex_count()
741 &r300->vertex_buffer[velems[i].vertex_buffer_index]; in r300_max_vertex_count()
768 value = r300->velems->format_size[i]; in r300_max_vertex_count()
785 struct r300_context* r300 = r300_context(pipe); in r300_draw_vbo() local
788 if (r300->skip_rendering || in r300_draw_vbo()
793 r300_update_derived_state(r300); in r300_draw_vbo()
797 unsigned max_count = r300_max_vertex_count(r300); in r300_draw_vbo()
814 r300_draw_elements_immediate(r300, &info); in r300_draw_vbo()
816 r300_draw_elements(r300, &info, -1); in r300_draw_vbo()
819 r300_draw_elements_instanced(r300, &info); in r300_draw_vbo()
823 if (immd_is_good_idea(r300, info.count)) { in r300_draw_vbo()
824 r300_draw_arrays_immediate(r300, &info); in r300_draw_vbo()
826 r300_draw_arrays(r300, &info, -1); in r300_draw_vbo()
829 r300_draw_arrays_instanced(r300, &info); in r300_draw_vbo()
843 struct r300_context* r300 = r300_context(pipe); in r300_swtcl_draw_vbo() local
845 if (r300->skip_rendering) { in r300_swtcl_draw_vbo()
853 draw_set_indexes(r300->draw, in r300_swtcl_draw_vbo()
860 r300_update_derived_state(r300); in r300_swtcl_draw_vbo()
862 draw_vbo(r300->draw, info); in r300_swtcl_draw_vbo()
863 draw_flush(r300->draw); in r300_swtcl_draw_vbo()
872 struct r300_context* r300; member
894 struct r300_context* r300 = r300render->r300; in r300_render_get_vertex_info() local
896 return &r300->vertex_info; in r300_render_get_vertex_info()
904 struct r300_context* r300 = r300render->r300; in r300_render_allocate_vertices() local
905 struct radeon_winsys *rws = r300->rws; in r300_render_allocate_vertices()
908 DBG(r300, DBG_DRAW, "r300: render_allocate_vertices (size: %d)\n", size); in r300_render_allocate_vertices()
910 if (!r300->vbo || size + r300->draw_vbo_offset > r300->vbo->size) { in r300_render_allocate_vertices()
911 pb_reference(&r300->vbo, NULL); in r300_render_allocate_vertices()
912 r300->vbo = NULL; in r300_render_allocate_vertices()
915 r300->vbo = rws->buffer_create(rws, in r300_render_allocate_vertices()
920 if (!r300->vbo) { in r300_render_allocate_vertices()
923 r300->draw_vbo_offset = 0; in r300_render_allocate_vertices()
924 r300render->vbo_ptr = rws->buffer_map(r300->vbo, r300->cs, in r300_render_allocate_vertices()
935 struct r300_context* r300 = r300render->r300; in r300_render_map_vertices() local
937 DBG(r300, DBG_DRAW, "r300: render_map_vertices\n"); in r300_render_map_vertices()
940 return r300render->vbo_ptr + r300->draw_vbo_offset; in r300_render_map_vertices()
948 struct r300_context* r300 = r300render->r300; in r300_render_unmap_vertices() local
950 DBG(r300, DBG_DRAW, "r300: render_unmap_vertices\n"); in r300_render_unmap_vertices()
959 struct r300_context* r300 = r300render->r300; in r300_render_release_vertices() local
961 DBG(r300, DBG_DRAW, "r300: render_release_vertices\n"); in r300_render_release_vertices()
963 r300->draw_vbo_offset += r300render->vbo_max_used; in r300_render_release_vertices()
981 struct r300_context* r300 = r300render->r300; in r300_render_draw_arrays() local
986 CS_LOCALS(r300); in r300_render_draw_arrays()
992 DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count); in r300_render_draw_arrays()
994 if (!r300_prepare_for_rendering(r300, in r300_render_draw_arrays()
1002 r300_provoking_vertex_fixes(r300, r300render->prim)); in r300_render_draw_arrays()
1015 struct r300_context* r300 = r300render->r300; in r300_render_draw_elements() local
1016 unsigned max_index = (r300->vbo->size - r300->draw_vbo_offset) / in r300_render_draw_elements()
1017 (r300render->r300->vertex_info.size * 4) - 1; in r300_render_draw_elements()
1021 CS_LOCALS(r300); in r300_render_draw_elements()
1022 DBG(r300, DBG_DRAW, "r300: render_draw_elements (count: %d)\n", count); in r300_render_draw_elements()
1024 u_upload_data(r300->uploader, 0, count * 2, 4, indices, in r300_render_draw_elements()
1030 if (!r300_prepare_for_rendering(r300, in r300_render_draw_elements()
1040 r300_provoking_vertex_fixes(r300, r300render->prim)); in r300_render_draw_elements()
1062 static struct vbuf_render* r300_render_create(struct r300_context* r300) in r300_render_create() argument
1066 r300render->r300 = r300; in r300_render_create()
1084 struct draw_stage* r300_draw_stage(struct r300_context* r300) in r300_draw_stage() argument
1089 render = r300_render_create(r300); in r300_draw_stage()
1095 stage = draw_vbuf_stage(r300->draw, render); in r300_draw_stage()
1102 draw_set_render(r300->draw, render); in r300_draw_stage()
1124 struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter)); in r300_blitter_draw_rectangle() local
1125 unsigned last_sprite_coord_enable = r300->sprite_coord_enable; in r300_blitter_draw_rectangle()
1129 type == UTIL_BLITTER_ATTRIB_COLOR || !r300->draw ? 8 : 4; in r300_blitter_draw_rectangle()
1133 CS_LOCALS(r300); in r300_blitter_draw_rectangle()
1137 if ((!r300->screen->caps.has_tcl && type == UTIL_BLITTER_ATTRIB_NONE) || in r300_blitter_draw_rectangle()
1146 if (r300->skip_rendering) in r300_blitter_draw_rectangle()
1149 r300->context.bind_vertex_elements_state(&r300->context, vertex_elements_cso); in r300_blitter_draw_rectangle()
1150 r300->context.bind_vs_state(&r300->context, get_vs(blitter)); in r300_blitter_draw_rectangle()
1153 r300->sprite_coord_enable = 1; in r300_blitter_draw_rectangle()
1155 r300_update_derived_state(r300); in r300_blitter_draw_rectangle()
1158 r300->viewport_state.dirty = FALSE; in r300_blitter_draw_rectangle()
1160 if (!r300_prepare_for_rendering(r300, PREP_EMIT_STATES, NULL, dwords, 0, 0, -1)) in r300_blitter_draw_rectangle()
1163 DBG(r300, DBG_DRAW, "r300: draw_rectangle\n"); in r300_blitter_draw_rectangle()
1207 r300_mark_atom_dirty(r300, &r300->rs_state); in r300_blitter_draw_rectangle()
1208 r300_mark_atom_dirty(r300, &r300->viewport_state); in r300_blitter_draw_rectangle()
1210 r300->sprite_coord_enable = last_sprite_coord_enable; in r300_blitter_draw_rectangle()
1213 void r300_init_render_functions(struct r300_context *r300) in r300_init_render_functions() argument
1216 if (r300->screen->caps.has_tcl) { in r300_init_render_functions()
1217 r300->context.draw_vbo = r300_draw_vbo; in r300_init_render_functions()
1219 r300->context.draw_vbo = r300_swtcl_draw_vbo; in r300_init_render_functions()
1223 if (!r300->screen->caps.is_r500) in r300_init_render_functions()
1224 r300_plug_in_stencil_ref_fallback(r300); in r300_init_render_functions()