diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-11-02 04:53:47 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-11-02 04:53:47 +0000 |
commit | b44518130b33cadb5c1d619e9e936ae0e0dbf7cb (patch) | |
tree | 6069eb03c39fbc79808a7d94f857118cce75cbe3 /lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c | |
parent | 32aeb3c41fedbbd7b11aacfec48e8f699d16bff0 (diff) |
Merge Mesa 23.1.9
Diffstat (limited to 'lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r-- | lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c | 87 |
1 files changed, 42 insertions, 45 deletions
diff --git a/lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c b/lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c index 1f81047a1..b8213ad54 100644 --- a/lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/lib/mesa/src/gallium/drivers/llvmpipe/lp_setup.c @@ -70,8 +70,6 @@ lp_setup_wait_empty_scene(struct lp_setup_context *setup) { /* just use the first scene if we run out */ if (setup->scenes[0]->fence) { - debug_printf("%s: wait for scene %d\n", - __FUNCTION__, setup->scenes[0]->fence->id); lp_fence_wait(setup->scenes[0]->fence); lp_scene_end_rasterization(setup->scenes[0]); } @@ -170,7 +168,7 @@ first_point(struct lp_setup_context *setup, void lp_setup_reset(struct lp_setup_context *setup) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); /* Reset derived state */ for (unsigned i = 0; i < ARRAY_SIZE(setup->constants); ++i) { @@ -217,7 +215,7 @@ lp_setup_rasterize_scene(struct lp_setup_context *setup) lp_setup_reset(setup); - LP_DBG(DEBUG_SETUP, "%s done \n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s done \n", __func__); } @@ -246,7 +244,7 @@ begin_binning(struct lp_setup_context *setup) need_zsload = TRUE; } - LP_DBG(DEBUG_SETUP, "%s color clear bufs: %x depth: %s\n", __FUNCTION__, + LP_DBG(DEBUG_SETUP, "%s color clear bufs: %x depth: %s\n", __func__, setup->clear.flags >> 2, need_zsload ? "clear": "load"); @@ -294,7 +292,7 @@ begin_binning(struct lp_setup_context *setup) scene->had_queries = !!setup->active_binned_queries; - LP_DBG(DEBUG_SETUP, "%s done\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s done\n", __func__); return TRUE; } @@ -307,7 +305,7 @@ begin_binning(struct lp_setup_context *setup) static boolean execute_clears(struct lp_setup_context *setup) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); return begin_binning(setup); } @@ -332,7 +330,7 @@ set_scene_state(struct lp_setup_context *setup, if (LP_DEBUG & DEBUG_SCENE) { debug_printf("%s old %s new %s%s%s\n", - __FUNCTION__, + __func__, states[old_state], states[new_state], (new_state == SETUP_FLUSHED) ? ": " : "", @@ -393,11 +391,11 @@ void lp_setup_bind_framebuffer(struct lp_setup_context *setup, const struct pipe_framebuffer_state *fb) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); /* Flush any old scene. */ - set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__); + set_scene_state(setup, SETUP_FLUSHED, __func__); /* * Ensure the old scene is not reused. @@ -412,6 +410,7 @@ lp_setup_bind_framebuffer(struct lp_setup_context *setup, setup->framebuffer.y0 = 0; setup->framebuffer.x1 = fb->width-1; setup->framebuffer.y1 = fb->height-1; + setup->viewport_index_slot = -1; setup->dirty |= LP_SETUP_NEW_SCISSOR; } @@ -429,7 +428,7 @@ lp_setup_try_clear_color_buffer(struct lp_setup_context *setup, union util_color uc; const enum pipe_format format = setup->fb.cbufs[cbuf]->format; - LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state); + LP_DBG(DEBUG_SETUP, "%s state %d\n", __func__, setup->state); util_pack_color_union(format, &uc, color); @@ -465,7 +464,7 @@ lp_setup_try_clear_color_buffer(struct lp_setup_context *setup, * buffers which the app or gallium frontend might issue * separately. */ - set_scene_state(setup, SETUP_CLEARED, __FUNCTION__); + set_scene_state(setup, SETUP_CLEARED, __func__); assert(PIPE_CLEAR_COLOR0 == (1 << 2)); setup->clear.flags |= 1 << (cbuf + 2); @@ -482,7 +481,7 @@ lp_setup_try_clear_zs(struct lp_setup_context *setup, unsigned stencil, unsigned flags) { - LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state); + LP_DBG(DEBUG_SETUP, "%s state %d\n", __func__, setup->state); enum pipe_format format = setup->fb.zsbuf->format; @@ -523,7 +522,7 @@ lp_setup_try_clear_zs(struct lp_setup_context *setup, * buffers which the app or gallium frontend might issue * separately. */ - set_scene_state(setup, SETUP_CLEARED, __FUNCTION__); + set_scene_state(setup, SETUP_CLEARED, __func__); setup->clear.flags |= flags; @@ -552,7 +551,7 @@ lp_setup_clear(struct lp_setup_context *setup, if (flags & PIPE_CLEAR_DEPTHSTENCIL) { unsigned flagszs = flags & PIPE_CLEAR_DEPTHSTENCIL; if (!lp_setup_try_clear_zs(setup, depth, stencil, flagszs)) { - set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__); + set_scene_state(setup, SETUP_FLUSHED, __func__); if (!lp_setup_try_clear_zs(setup, depth, stencil, flagszs)) assert(0); @@ -564,7 +563,7 @@ lp_setup_clear(struct lp_setup_context *setup, for (unsigned i = 0; i < setup->fb.nr_cbufs; i++) { if ((flags & (1 << (2 + i))) && setup->fb.cbufs[i]) { if (!lp_setup_try_clear_color_buffer(setup, color, i)) { - set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__); + set_scene_state(setup, SETUP_FLUSHED, __func__); if (!lp_setup_try_clear_color_buffer(setup, color, i)) assert(0); @@ -579,7 +578,7 @@ void lp_setup_bind_rasterizer(struct lp_setup_context *setup, const struct pipe_rasterizer_state *rast) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); setup->ccw_is_frontface = rast->front_ccw; setup->cullmode = rast->cull_face; @@ -601,7 +600,7 @@ lp_setup_bind_rasterizer(struct lp_setup_context *setup, setup->point_size = rast->point_size; setup->sprite_coord_enable = rast->sprite_coord_enable; setup->sprite_coord_origin = rast->sprite_coord_mode; - setup->point_tri_clip = rast->point_size_per_vertex; + setup->point_tri_clip = rast->point_tri_clip; setup->point_size_per_vertex = rast->point_size_per_vertex; setup->legacy_points = !rast->point_quad_rasterization && !setup->multisample; } @@ -611,7 +610,7 @@ void lp_setup_set_setup_variant(struct lp_setup_context *setup, const struct lp_setup_variant *variant) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); setup->setup.variant = variant; } @@ -621,7 +620,7 @@ void lp_setup_set_fs_variant(struct lp_setup_context *setup, struct lp_fragment_shader_variant *variant) { - LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, variant); + LP_DBG(DEBUG_SETUP, "%s %p\n", __func__, variant); setup->fs.current.variant = variant; setup->dirty |= LP_SETUP_NEW_FS; @@ -633,7 +632,7 @@ lp_setup_set_fs_constants(struct lp_setup_context *setup, unsigned num, struct pipe_constant_buffer *buffers) { - LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) buffers); + LP_DBG(DEBUG_SETUP, "%s %p\n", __func__, (void *) buffers); assert(num <= ARRAY_SIZE(setup->constants)); @@ -655,7 +654,7 @@ lp_setup_set_fs_ssbos(struct lp_setup_context *setup, struct pipe_shader_buffer *buffers, uint32_t ssbo_write_mask) { - LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) buffers); + LP_DBG(DEBUG_SETUP, "%s %p\n", __func__, (void *) buffers); assert(num <= ARRAY_SIZE(setup->ssbos)); @@ -678,7 +677,7 @@ lp_setup_set_fs_images(struct lp_setup_context *setup, { unsigned i; - LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) images); + LP_DBG(DEBUG_SETUP, "%s %p\n", __func__, (void *) images); assert(num <= ARRAY_SIZE(setup->images)); @@ -750,7 +749,7 @@ void lp_setup_set_alpha_ref_value(struct lp_setup_context *setup, float alpha_ref_value) { - LP_DBG(DEBUG_SETUP, "%s %f\n", __FUNCTION__, alpha_ref_value); + LP_DBG(DEBUG_SETUP, "%s %f\n", __func__, alpha_ref_value); if (setup->fs.current.jit_context.alpha_ref_value != alpha_ref_value) { setup->fs.current.jit_context.alpha_ref_value = alpha_ref_value; @@ -763,7 +762,7 @@ void lp_setup_set_stencil_ref_values(struct lp_setup_context *setup, const ubyte refs[2]) { - LP_DBG(DEBUG_SETUP, "%s %d %d\n", __FUNCTION__, refs[0], refs[1]); + LP_DBG(DEBUG_SETUP, "%s %d %d\n", __func__, refs[0], refs[1]); if (setup->fs.current.jit_context.stencil_ref_front != refs[0] || setup->fs.current.jit_context.stencil_ref_back != refs[1]) { @@ -778,7 +777,7 @@ void lp_setup_set_blend_color(struct lp_setup_context *setup, const struct pipe_blend_color *blend_color) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); assert(blend_color); @@ -794,7 +793,7 @@ void lp_setup_set_scissors(struct lp_setup_context *setup, const struct pipe_scissor_state *scissors) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); assert(scissors); @@ -852,7 +851,7 @@ lp_setup_set_linear_mode(struct lp_setup_context *setup, * is more than ten-year-old technology, so it's a reasonable * baseline. */ -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE setup->permit_linear_rasterizer = (mode && util_get_cpu_caps()->has_sse2); #else @@ -871,7 +870,7 @@ lp_setup_set_viewports(struct lp_setup_context *setup, { struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); assert(num_viewports <= PIPE_MAX_VIEWPORTS); assert(viewports); @@ -923,7 +922,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, unsigned num, struct pipe_sampler_view **views) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); assert(num <= PIPE_MAX_SHADER_SAMPLER_VIEWS); @@ -1073,7 +1072,7 @@ lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, unsigned num, struct pipe_sampler_state **samplers) { - LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); + LP_DBG(DEBUG_SETUP, "%s\n", __func__); assert(num <= PIPE_MAX_SAMPLERS); @@ -1117,17 +1116,10 @@ lp_setup_is_resource_referenced(const struct lp_setup_context *setup, /* check resources referenced by active scenes */ for (unsigned i = 0; i < setup->num_active_scenes; i++) { struct lp_scene *scene = setup->scenes[i]; - /* check the render targets */ - for (unsigned j = 0; j < scene->fb.nr_cbufs; j++) { - if (scene->fb.cbufs[j] && scene->fb.cbufs[j]->texture == texture) - return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE; - } - if (scene->fb.zsbuf && scene->fb.zsbuf->texture == texture) { - return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE; - } - /* check resources referenced by the scene */ + mtx_lock(&scene->mutex); unsigned ref = lp_scene_is_resource_referenced(scene, texture); + mtx_unlock(&scene->mutex); if (ref) return ref; } @@ -1458,7 +1450,7 @@ lp_setup_update_state(struct lp_setup_context *setup, } if (update_scene && setup->state != SETUP_ACTIVE) { - if (!set_scene_state(setup, SETUP_ACTIVE, __FUNCTION__)) + if (!set_scene_state(setup, SETUP_ACTIVE, __func__)) return FALSE; } @@ -1476,10 +1468,10 @@ lp_setup_update_state(struct lp_setup_context *setup, * Cannot call lp_setup_flush_and_restart() directly here * because of potential recursion. */ - if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) + if (!set_scene_state(setup, SETUP_FLUSHED, __func__)) return FALSE; - if (!set_scene_state(setup, SETUP_ACTIVE, __FUNCTION__)) + if (!set_scene_state(setup, SETUP_ACTIVE, __func__)) return FALSE; if (!setup->scene) @@ -1555,6 +1547,11 @@ lp_setup_create(struct pipe_context *pipe, lp_setup_init_vbuf(setup); + setup->psize_slot = -1; + setup->viewport_index_slot = -1; + setup->layer_slot = -1; + setup->face_slot = -1; + /* Used only in update_state(): */ setup->pipe = pipe; @@ -1731,11 +1728,11 @@ fail: boolean lp_setup_flush_and_restart(struct lp_setup_context *setup) { - if (0) debug_printf("%s\n", __FUNCTION__); + if (0) debug_printf("%s\n", __func__); assert(setup->state == SETUP_ACTIVE); - if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__)) + if (!set_scene_state(setup, SETUP_FLUSHED, __func__)) return FALSE; if (!lp_setup_update_state(setup, TRUE)) |