struct lp_scene *scene = setup->scene;
boolean need_zsload = FALSE;
boolean ok;
- unsigned i, j;
+ unsigned i;
assert(scene);
assert(scene->fence == NULL);
if (!scene->fence)
return FALSE;
- /* Initialize the bin flags and x/y coords:
- */
- for (i = 0; i < scene->tiles_x; i++) {
- for (j = 0; j < scene->tiles_y; j++) {
- scene->tile[i][j].x = i;
- scene->tile[i][j].y = j;
- }
- }
-
ok = try_update_scene_state(setup);
if (!ok)
return FALSE;
unsigned stencil,
unsigned flags )
{
- uint32_t zsmask = 0;
- uint32_t zsvalue = 0;
+ uint64_t zsmask = 0;
+ uint64_t zsvalue = 0;
union lp_rast_cmd_arg color_arg;
unsigned i;
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
uint32_t zmask = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0;
- uint32_t smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0;
+ uint8_t smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0;
- zsvalue = util_pack_z_stencil(setup->fb.zsbuf->format,
- depth,
- stencil);
+ zsvalue = util_pack64_z_stencil(setup->fb.zsbuf->format,
+ depth,
+ stencil);
- zsmask = util_pack_mask_z_stencil(setup->fb.zsbuf->format,
- zmask,
- smask);
+ zsmask = util_pack64_mask_z_stencil(setup->fb.zsbuf->format,
+ zmask,
+ smask);
zsvalue &= zsmask;
}
unsigned cull_mode,
boolean ccw_is_frontface,
boolean scissor,
- boolean gl_rasterization_rules)
+ boolean half_pixel_center,
+ boolean bottom_edge_rule)
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
setup->ccw_is_frontface = ccw_is_frontface;
setup->cullmode = cull_mode;
setup->triangle = first_triangle;
- setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f;
+ setup->pixel_offset = half_pixel_center ? 0.5f : 0.0f;
+ setup->bottom_edge_rule = bottom_edge_rule;
if (setup->scissor_test != scissor) {
setup->dirty |= LP_SETUP_NEW_SCISSOR;
void
-lp_setup_set_scissor( struct lp_setup_context *setup,
- const struct pipe_scissor_state *scissor )
+lp_setup_set_scissors( struct lp_setup_context *setup,
+ const struct pipe_scissor_state *scissors )
{
+ unsigned i;
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
- assert(scissor);
+ assert(scissors);
- setup->scissor.x0 = scissor->minx;
- setup->scissor.x1 = scissor->maxx-1;
- setup->scissor.y0 = scissor->miny;
- setup->scissor.y1 = scissor->maxy-1;
+ for (i = 0; i < PIPE_MAX_VIEWPORTS; ++i) {
+ setup->scissors[i].x0 = scissors[i].minx;
+ setup->scissors[i].x1 = scissors[i].maxx-1;
+ setup->scissors[i].y0 = scissors[i].miny;
+ setup->scissors[i].y1 = scissors[i].maxy-1;
+ }
setup->dirty |= LP_SETUP_NEW_SCISSOR;
}
assert(last_level <= res->last_level);
/*
- * The complexity here is only necessary for depth textures which
- * still are tiled.
+ * The complexity here should no longer be necessary.
*/
mip_ptr = llvmpipe_get_texture_image_all(lp_tex, first_level,
- LP_TEX_USAGE_READ,
- LP_TEX_LAYOUT_LINEAR);
+ LP_TEX_USAGE_READ);
jit_tex->base = lp_tex->linear_img.data;
}
else {
if (llvmpipe_resource_is_texture(res)) {
for (j = first_level; j <= last_level; j++) {
mip_ptr = llvmpipe_get_texture_image_all(lp_tex, j,
- LP_TEX_USAGE_READ,
- LP_TEX_LAYOUT_LINEAR);
+ LP_TEX_USAGE_READ);
jit_tex->mip_offsets[j] = (uint8_t *)mip_ptr - (uint8_t *)jit_tex->base;
/*
* could get mip offset directly but need call above to
jit_tex->img_stride[j] = lp_tex->img_stride[j];
}
- /*
- * We don't use anything like first_element (for buffers) or
- * first_layer (for arrays), instead adjust the last_element
- * (width) or last_layer (depth) plus the base pointer.
- * Less parameters and faster at shader execution.
- * XXX Could do the same for mip levels.
- */
if (res->target == PIPE_TEXTURE_1D_ARRAY ||
res->target == PIPE_TEXTURE_2D_ARRAY) {
+ /*
+ * For array textures, we don't have first_layer, instead
+ * adjust last_layer (stored as depth) plus the mip level offsets
+ * (as we have mip-first layout can't just adjust base ptr).
+ * XXX For mip levels, could do something similar.
+ */
jit_tex->depth = view->u.tex.last_layer - view->u.tex.first_layer + 1;
- jit_tex->base = (uint8_t *)jit_tex->base +
- view->u.tex.first_layer * lp_tex->img_stride[0];
+ for (j = first_level; j <= last_level; j++) {
+ jit_tex->mip_offsets[j] += view->u.tex.first_layer *
+ lp_tex->img_stride[j];
+ }
assert(view->u.tex.first_layer <= view->u.tex.last_layer);
assert(view->u.tex.last_layer < res->array_size);
}
}
else {
+ /*
+ * For buffers, we don't have first_element, instead adjust
+ * last_element (stored as width) plus the base pointer.
+ */
unsigned view_blocksize = util_format_get_blocksize(view->format);
/* probably don't really need to fill that out */
jit_tex->mip_offsets[0] = 0;
}
if (setup->dirty & LP_SETUP_NEW_SCISSOR) {
- setup->draw_region = setup->framebuffer;
- if (setup->scissor_test) {
- u_rect_possible_intersection(&setup->scissor,
- &setup->draw_region);
+ unsigned i;
+ for (i = 0; i < PIPE_MAX_VIEWPORTS; ++i) {
+ setup->draw_regions[i] = setup->framebuffer;
+ if (setup->scissor_test) {
+ u_rect_possible_intersection(&setup->scissors[i],
+ &setup->draw_regions[i]);
+ }
}
+ /* If the framebuffer is large we have to think about fixed-point
+ * integer overflow. For 2K by 2K images, coordinates need 15 bits
+ * (2^11 + 4 subpixel bits). The product of two such numbers would
+ * use 30 bits. Any larger and we could overflow a 32-bit int.
+ *
+ * To cope with this problem we check if triangles are large and
+ * subdivide them if needed.
+ */
+ setup->subdivide_large_triangles = (setup->fb.width > 2048 &&
+ setup->fb.height > 2048);
}
setup->dirty = 0;
* to know about vertex shader point size attribute.
*/
setup->psize = lp->psize_slot;
+ setup->viewport_index_slot = lp->viewport_index_slot;
assert(lp->dirty == 0);