diff options
author | Marek Olšák <[email protected]> | 2012-09-12 23:37:17 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-30 18:57:56 +0200 |
commit | 0b0697e80dd442d7e7cb23641ad8f58f82df120d (patch) | |
tree | 3f842d9000c8c26fc3812f08276846af4772b579 /src/gallium/auxiliary/util/u_blitter.h | |
parent | 84d2f2295e8274c1b3676b59fedfc173836d378e (diff) |
gallium/u_blitter: add gallium blit implementation
The original blit function is extended and the otAher functions reuse it.
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_blitter.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.h | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index 43b732699e3..026e88b5154 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -74,7 +74,7 @@ struct blitter_context * a rectangular point sprite. */ void (*draw_rectangle)(struct blitter_context *blitter, - unsigned x1, unsigned y1, unsigned x2, unsigned y2, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *color); @@ -94,6 +94,7 @@ struct blitter_context struct pipe_framebuffer_state saved_fb_state; /**< framebuffer state */ struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */ struct pipe_viewport_state saved_viewport; + struct pipe_scissor_state saved_scissor; boolean is_sample_mask_saved; unsigned saved_sample_mask; @@ -137,9 +138,7 @@ struct pipe_context *util_blitter_get_pipe(struct blitter_context *blitter) /* The default function to draw a rectangle. This can only be used * inside of the draw_rectangle callback if the driver overrides it. */ void util_blitter_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, - unsigned x2, unsigned y2, - float depth, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib); @@ -180,19 +179,13 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter, const struct pipe_resource *dst, const struct pipe_resource *src, unsigned mask); + +boolean util_blitter_is_blit_supported(struct blitter_context *blitter, + const struct pipe_blit_info *info); + /** * Copy a block of pixels from one surface to another. * - * You can copy from any color format to any other color format provided - * the former can be sampled from and the latter can be rendered to. Otherwise, - * a software fallback path is taken and both surfaces must be of the same - * format. - * - * Only one sample of a multisample texture can be copied and is specified by - * src_sample. If the destination is a multisample resource, dst_sample_mask - * specifies the sample mask. For single-sample resources, set dst_sample_mask - * to ~0. - * * These states must be saved in the blitter in addition to the state objects * already required to be saved: * - fragment shader @@ -201,19 +194,21 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter, * - fragment sampler states * - fragment sampler textures * - framebuffer state + * - sample mask */ void util_blitter_copy_texture(struct blitter_context *blitter, struct pipe_resource *dst, - unsigned dst_level, unsigned dst_sample_mask, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - unsigned src_level, unsigned src_sample, - const struct pipe_box *srcbox); + unsigned src_level, + const struct pipe_box *srcbox, unsigned mask, + boolean copy_all_samples); /** - * Same as util_blitter_copy_texture, but dst and src are pipe_surface and - * pipe_sampler_view, respectively. The mipmap level and dstz are part of - * the views. + * Same as util_blitter_copy_texture with the capabilities of util_blitter_blit, + * but dst and src are pipe_surface and pipe_sampler_view, respectively. + * The mipmap level and dstz are part of the views. * * Drivers can use this to change resource properties (like format, width, * height) by changing how the views interpret them, instead of changing @@ -227,18 +222,20 @@ void util_blitter_copy_texture(struct blitter_context *blitter, * * The mask is a combination of the PIPE_MASK_* flags. * Set to PIPE_MASK_RGBAZS if unsure. - * - * NOTE: There are no checks whether the blit is actually supported. */ -void util_blitter_copy_texture_view(struct blitter_context *blitter, - struct pipe_surface *dst, - unsigned dst_sample_mask, - unsigned dstx, unsigned dsty, - struct pipe_sampler_view *src, - unsigned src_sample, - const struct pipe_box *srcbox, - unsigned src_width0, unsigned src_height0, - unsigned mask); +void util_blitter_blit_generic(struct blitter_context *blitter, + struct pipe_surface *dst, + int dstx, int dsty, + unsigned dst_width, unsigned dst_height, + struct pipe_sampler_view *src, + const struct pipe_box *srcbox, + unsigned src_width0, unsigned src_height0, + unsigned mask, unsigned filter, + const struct pipe_scissor_state *scissor, + boolean copy_all_samples); + +void util_blitter_blit(struct blitter_context *blitter, + const struct pipe_blit_info *info); /** * Helper function to initialize a view for copy_texture_view. @@ -416,6 +413,13 @@ void util_blitter_save_viewport(struct blitter_context *blitter, } static INLINE +void util_blitter_save_scissor(struct blitter_context *blitter, + struct pipe_scissor_state *state) +{ + blitter->saved_scissor = *state; +} + +static INLINE void util_blitter_save_fragment_sampler_states( struct blitter_context *blitter, int num_sampler_states, |