/** * Clear the given buffers to the specified values. * No masking, no scissor (clear entire buffer). */ void softpipe_clear(struct pipe_context *pipe, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); uint64_t cv; uint i; if (softpipe->no_rast) return; if (!softpipe_check_render_cond(softpipe)) return; #if 0 softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */ #endif if (buffers & PIPE_CLEAR_COLOR) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { sp_tile_cache_clear(softpipe->cbuf_cache[i], color, 0); } } if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { static const union pipe_color_union zero; struct pipe_surface *ps = softpipe->framebuffer.zsbuf; cv = util_pack64_z_stencil(ps->format, depth, stencil); sp_tile_cache_clear(softpipe->zsbuf_cache, &zero, cv); } softpipe->dirty_render_cache = TRUE; }
static void sp_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) { struct softpipe_context *sp = softpipe_context(pipe); if (info->render_condition_enable && !softpipe_check_render_cond(sp)) return; if (info->src.resource->nr_samples > 1 && info->dst.resource->nr_samples <= 1 && !util_format_is_depth_or_stencil(info->src.resource->format) && !util_format_is_pure_integer(info->src.resource->format)) { debug_printf("softpipe: color resolve unimplemented\n"); return; } if (util_try_blit_via_copy_region(pipe, info)) { return; /* done */ } if (!util_blitter_is_blit_supported(sp->blitter, info)) { debug_printf("softpipe: blit unsupported %s -> %s\n", util_format_short_name(info->src.resource->format), util_format_short_name(info->dst.resource->format)); return; } /* XXX turn off occlusion and streamout queries */ util_blitter_save_vertex_buffer_slot(sp->blitter, sp->vertex_buffer); util_blitter_save_vertex_elements(sp->blitter, sp->velems); util_blitter_save_vertex_shader(sp->blitter, sp->vs); util_blitter_save_geometry_shader(sp->blitter, sp->gs); util_blitter_save_so_targets(sp->blitter, sp->num_so_targets, (struct pipe_stream_output_target**)sp->so_targets); util_blitter_save_rasterizer(sp->blitter, sp->rasterizer); util_blitter_save_viewport(sp->blitter, &sp->viewports[0]); util_blitter_save_scissor(sp->blitter, &sp->scissors[0]); util_blitter_save_fragment_shader(sp->blitter, sp->fs); util_blitter_save_blend(sp->blitter, sp->blend); util_blitter_save_depth_stencil_alpha(sp->blitter, sp->depth_stencil); util_blitter_save_stencil_ref(sp->blitter, &sp->stencil_ref); /*util_blitter_save_sample_mask(sp->blitter, sp->sample_mask);*/ util_blitter_save_framebuffer(sp->blitter, &sp->framebuffer); util_blitter_save_fragment_sampler_states(sp->blitter, sp->num_samplers[PIPE_SHADER_FRAGMENT], (void**)sp->samplers[PIPE_SHADER_FRAGMENT]); util_blitter_save_fragment_sampler_views(sp->blitter, sp->num_sampler_views[PIPE_SHADER_FRAGMENT], sp->sampler_views[PIPE_SHADER_FRAGMENT]); util_blitter_save_render_condition(sp->blitter, sp->render_cond_query, sp->render_cond_cond, sp->render_cond_mode); util_blitter_blit(sp->blitter, info); }
static void softpipe_clear_render_target(struct pipe_context *pipe, struct pipe_surface *dst, const union pipe_color_union *color, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { struct softpipe_context *softpipe = softpipe_context(pipe); if (!softpipe_check_render_cond(softpipe)) return; util_clear_render_target(pipe, dst, color, dstx, dsty, width, height); }
static void softpipe_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *dst, unsigned clear_flags, double depth, unsigned stencil, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { struct softpipe_context *softpipe = softpipe_context(pipe); if (!softpipe_check_render_cond(softpipe)) return; util_clear_depth_stencil(pipe, dst, clear_flags, depth, stencil, dstx, dsty, width, height); }
/** * Clear the given buffers to the specified values. * No masking, no scissor (clear entire buffer). */ void softpipe_clear(struct pipe_context *pipe, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); struct pipe_surface *zsbuf = softpipe->framebuffer.zsbuf; unsigned zs_buffers = buffers & PIPE_CLEAR_DEPTHSTENCIL; uint64_t cv; uint i; if (softpipe->no_rast) return; if (!softpipe_check_render_cond(softpipe)) return; #if 0 softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */ #endif if (buffers & PIPE_CLEAR_COLOR) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { sp_tile_cache_clear(softpipe->cbuf_cache[i], color, 0); } } if (zs_buffers && util_format_is_depth_and_stencil(zsbuf->texture->format) && zs_buffers != PIPE_CLEAR_DEPTHSTENCIL) { /* Clearing only depth or stencil in a combined depth-stencil buffer. */ util_clear_depth_stencil(pipe, zsbuf, zs_buffers, depth, stencil, 0, 0, zsbuf->width, zsbuf->height); } else if (zs_buffers) { static const union pipe_color_union zero; cv = util_pack64_z_stencil(zsbuf->format, depth, stencil); sp_tile_cache_clear(softpipe->zsbuf_cache, &zero, cv); } softpipe->dirty_render_cache = TRUE; }
/** * Clear the given buffers to the specified values. * No masking, no scissor (clear entire buffer). */ void softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); union util_color uc; unsigned cv; uint i; if (softpipe->no_rast) return; if (!softpipe_check_render_cond(softpipe)) return; #if 0 softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */ #endif if (buffers & PIPE_CLEAR_COLOR) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; util_pack_color(rgba, ps->format, &uc); sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui); } } if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; struct pipe_surface *ps = softpipe->framebuffer.zsbuf; cv = util_pack_z_stencil(ps->format, depth, stencil); sp_tile_cache_clear(softpipe->zsbuf_cache, zero, cv); } softpipe->dirty_render_cache = TRUE; }