diff options
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blit.c | 53 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blitter.c | 134 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blitter.h | 40 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_format_tests.c | 13 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c | 17 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_surface.c | 6 |
6 files changed, 161 insertions, 102 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index b52f4c092..3887e65fb 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -478,10 +478,11 @@ util_blit_pixels(struct blit_state *ctx, /* * Check for simple case: no format conversion, no flipping, no stretching, - * no overlapping. + * no overlapping, same number of samples. * Filter mode should not matter since there's no stretching. */ if (formats_compatible(src_format, dst_format) && + src_tex->nr_samples == dst->texture->nr_samples && is_stencil == blit_stencil && is_depth == blit_depth && srcX0 < srcX1 && @@ -506,6 +507,12 @@ util_blit_pixels(struct blit_state *ctx, return; } + /* XXX Reading multisample textures is unimplemented. */ + assert(src_tex->nr_samples <= 1); + if (src_tex->nr_samples > 1) { + return; + } + /* It's a mistake to call this function with a stencil format and * without shader stencil export. We don't do software fallbacks here. * Ignore stencil and only copy depth. @@ -648,8 +655,9 @@ util_blit_pixels(struct blit_state *ctx, cso_save_blend(ctx->cso); cso_save_depth_stencil_alpha(ctx->cso); cso_save_rasterizer(ctx->cso); - cso_save_samplers(ctx->cso); - cso_save_fragment_sampler_views(ctx->cso); + cso_save_sample_mask(ctx->cso); + cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); cso_save_stream_outputs(ctx->cso); cso_save_viewport(ctx->cso); cso_save_framebuffer(ctx->cso); @@ -665,6 +673,7 @@ util_blit_pixels(struct blit_state *ctx, else cso_set_blend(ctx->cso, &ctx->blend_keep_color); + cso_set_sample_mask(ctx->cso, ~0); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); cso_set_stream_outputs(ctx->cso, 0, NULL, 0); @@ -680,17 +689,17 @@ util_blit_pixels(struct blit_state *ctx, * we blit. */ if (blit_depth && blit_stencil) { - cso_single_sampler(ctx->cso, 0, &ctx->sampler); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); /* don't filter stencil */ ctx->sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; ctx->sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; - cso_single_sampler(ctx->cso, 1, &ctx->sampler); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &ctx->sampler); cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_depthstencil); set_depthstencil_fragment_shader(ctx, sampler_view->texture->target); } else if (blit_depth) { - cso_single_sampler(ctx->cso, 0, &ctx->sampler); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_depth); set_depth_fragment_shader(ctx, sampler_view->texture->target); } @@ -698,17 +707,17 @@ util_blit_pixels(struct blit_state *ctx, /* don't filter stencil */ ctx->sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; ctx->sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; - cso_single_sampler(ctx->cso, 0, &ctx->sampler); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_stencil); set_stencil_fragment_shader(ctx, sampler_view->texture->target); } else { /* color */ - cso_single_sampler(ctx->cso, 0, &ctx->sampler); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_keep_depthstencil); set_fragment_shader(ctx, writemask, sampler_view->texture->target); } - cso_single_sampler_done(ctx->cso); + cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT); /* textures */ if (blit_depth && blit_stencil) { @@ -722,12 +731,12 @@ util_blit_pixels(struct blit_state *ctx, views[0] = sampler_view; views[1] = pipe->create_sampler_view(pipe, views[0]->texture, &templ); - cso_set_fragment_sampler_views(ctx->cso, 2, views); + cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 2, views); pipe_sampler_view_reference(&views[1], NULL); } else { - cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view); + cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &sampler_view); } /* viewport */ @@ -777,8 +786,9 @@ util_blit_pixels(struct blit_state *ctx, cso_restore_blend(ctx->cso); cso_restore_depth_stencil_alpha(ctx->cso); cso_restore_rasterizer(ctx->cso); - cso_restore_samplers(ctx->cso); - cso_restore_fragment_sampler_views(ctx->cso); + cso_restore_sample_mask(ctx->cso); + cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); cso_restore_viewport(ctx->cso); cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); @@ -849,8 +859,9 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_save_blend(ctx->cso); cso_save_depth_stencil_alpha(ctx->cso); cso_save_rasterizer(ctx->cso); - cso_save_samplers(ctx->cso); - cso_save_fragment_sampler_views(ctx->cso); + cso_save_sample_mask(ctx->cso); + cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); cso_save_stream_outputs(ctx->cso); cso_save_viewport(ctx->cso); cso_save_framebuffer(ctx->cso); @@ -863,6 +874,7 @@ util_blit_pixels_tex(struct blit_state *ctx, /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend_write_color); cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_keep_depthstencil); + cso_set_sample_mask(ctx->cso, ~0); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); cso_set_stream_outputs(ctx->cso, 0, NULL, 0); @@ -871,8 +883,8 @@ util_blit_pixels_tex(struct blit_state *ctx, ctx->sampler.normalized_coords = normalized; ctx->sampler.min_img_filter = filter; ctx->sampler.mag_img_filter = filter; - cso_single_sampler(ctx->cso, 0, &ctx->sampler); - cso_single_sampler_done(ctx->cso); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); + cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT); /* viewport */ ctx->viewport.scale[0] = 0.5f * dst->width; @@ -886,7 +898,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_set_viewport(ctx->cso, &ctx->viewport); /* texture */ - cso_set_fragment_sampler_views(ctx->cso, 1, &src_sampler_view); + cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &src_sampler_view); /* shaders */ set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW, @@ -921,8 +933,9 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_restore_blend(ctx->cso); cso_restore_depth_stencil_alpha(ctx->cso); cso_restore_rasterizer(ctx->cso); - cso_restore_samplers(ctx->cso); - cso_restore_fragment_sampler_views(ctx->cso); + cso_restore_sample_mask(ctx->cso); + cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); cso_restore_viewport(ctx->cso); cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index b31ac2d5c..fa71f25ea 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -439,6 +439,12 @@ static void blitter_restore_fragment_states(struct blitter_context_priv *ctx) pipe->bind_blend_state(pipe, ctx->base.saved_blend_state); ctx->base.saved_blend_state = INVALID_PTR; + /* Sample mask. */ + if (ctx->base.is_sample_mask_saved) { + pipe->set_sample_mask(pipe, ctx->base.saved_sample_mask); + ctx->base.is_sample_mask_saved = FALSE; + } + /* Miscellaneous states. */ /* XXX check whether these are saved and whether they need to be restored * (depending on the operation) */ @@ -848,6 +854,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, pipe->bind_vertex_elements_state(pipe, ctx->velem_state); } pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, num_cbufs, int_format)); + pipe->set_sample_mask(pipe, ~0); blitter_set_common_draw_rect_state(ctx); blitter_set_dst_dimensions(ctx, width, height); @@ -925,66 +932,89 @@ void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ, src_templ->swizzle_a = PIPE_SWIZZLE_ALPHA; } +boolean util_blitter_is_copy_supported(struct blitter_context *blitter, + const struct pipe_resource *dst, + const struct pipe_resource *src, + unsigned mask) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + struct pipe_screen *screen = ctx->base.pipe->screen; + + if (dst) { + unsigned bind; + boolean is_stencil; + const struct util_format_description *desc = + util_format_description(dst->format); + + is_stencil = util_format_has_stencil(desc); + + /* Stencil export must be supported for stencil copy. */ + if ((mask & PIPE_MASK_S) && is_stencil && !ctx->has_stencil_export) { + return FALSE; + } + + if (is_stencil || util_format_has_depth(desc)) + bind = PIPE_BIND_DEPTH_STENCIL; + else + bind = PIPE_BIND_RENDER_TARGET; + + if (!screen->is_format_supported(screen, dst->format, dst->target, + dst->nr_samples, bind)) { + return FALSE; + } + } + + if (src) { + if (!screen->is_format_supported(screen, src->format, src->target, + src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { + return FALSE; + } + + /* Check stencil sampler support for stencil copy. */ + if (util_format_has_stencil(util_format_description(src->format))) { + enum pipe_format stencil_format = + util_format_stencil_only(src->format); + assert(stencil_format != PIPE_FORMAT_NONE); + + if (stencil_format != src->format && + !screen->is_format_supported(screen, stencil_format, src->target, + src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { + return FALSE; + } + } + } + + return TRUE; +} + void util_blitter_copy_texture(struct blitter_context *blitter, struct pipe_resource *dst, - unsigned dstlevel, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - unsigned srclevel, - const struct pipe_box *srcbox, - boolean ignore_stencil) + unsigned src_level, + const struct pipe_box *srcbox) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; - struct pipe_screen *screen = pipe->screen; struct pipe_surface *dst_view, dst_templ; struct pipe_sampler_view src_templ, *src_view; - unsigned bind; - boolean is_stencil, is_depth; - const struct util_format_description *src_desc = - util_format_description(src->format); - /* Give up if textures are not set. */ assert(dst && src); - if (!dst || !src) - return; - assert(src->target < PIPE_MAX_TEXTURE_TYPES); - /* Is this a ZS format? */ - is_depth = util_format_has_depth(src_desc); - is_stencil = util_format_has_stencil(src_desc); - - if (is_depth || is_stencil) - bind = PIPE_BIND_DEPTH_STENCIL; - else - bind = PIPE_BIND_RENDER_TARGET; - - /* Check if we can sample from and render to the surfaces. */ - /* (assuming copying a stencil buffer is not possible) */ - if ((!ignore_stencil && is_stencil && !ctx->has_stencil_export) || - !screen->is_format_supported(screen, dst->format, dst->target, - dst->nr_samples, bind) || - !screen->is_format_supported(screen, src->format, src->target, - src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { - blitter_set_running_flag(ctx); - util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz, - src, srclevel, srcbox); - blitter_unset_running_flag(ctx); - return; - } - /* Initialize the surface. */ - util_blitter_default_dst_texture(&dst_templ, dst, dstlevel, dstz, srcbox); + util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz, srcbox); dst_view = pipe->create_surface(pipe, dst, &dst_templ); /* Initialize the sampler view. */ - util_blitter_default_src_texture(&src_templ, src, srclevel); + util_blitter_default_src_texture(&src_templ, src, src_level); src_view = pipe->create_sampler_view(pipe, src, &src_templ); /* Copy. */ util_blitter_copy_texture_view(blitter, dst_view, dstx, dsty, src_view, - srcbox, src->width0, src->height0); + srcbox, src->width0, src->height0, + PIPE_MASK_RGBAZS); pipe_surface_reference(&dst_view, NULL); pipe_sampler_view_reference(&src_view, NULL); @@ -995,7 +1025,8 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, unsigned dstx, unsigned dsty, struct pipe_sampler_view *src, const struct pipe_box *srcbox, - unsigned src_width0, unsigned src_height0) + unsigned src_width0, unsigned src_height0, + unsigned mask) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; @@ -1003,19 +1034,19 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, enum pipe_texture_target src_target = src->texture->target; unsigned width = srcbox->width; unsigned height = srcbox->height; - boolean is_stencil, is_depth; + boolean blit_stencil, blit_depth; const struct util_format_description *src_desc = util_format_description(src->format); - is_depth = util_format_has_depth(src_desc); - is_stencil = util_format_has_stencil(src_desc); + blit_depth = util_format_has_depth(src_desc) && (mask & PIPE_MASK_Z); + blit_stencil = util_format_has_stencil(src_desc) && (mask & PIPE_MASK_S); /* If you want a fallback for stencil copies, * use util_blitter_copy_texture. */ - if (is_stencil && !ctx->has_stencil_export) { - is_stencil = FALSE; + if (blit_stencil && !ctx->has_stencil_export) { + blit_stencil = FALSE; - if (!is_depth) + if (!blit_depth) return; } @@ -1039,15 +1070,15 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, fb_state.width = dst->width; fb_state.height = dst->height; - if (is_depth || is_stencil) { + if (blit_depth || blit_stencil) { pipe->bind_blend_state(pipe, ctx->blend_keep_color); - if (is_depth && is_stencil) { + if (blit_depth && blit_stencil) { pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_write_depth_stencil); pipe->bind_fs_state(pipe, blitter_get_fs_texfetch_depthstencil(ctx, src_target)); - } else if (is_depth) { + } else if (blit_depth) { pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_write_depth_keep_stencil); pipe->bind_fs_state(pipe, @@ -1072,7 +1103,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, fb_state.zsbuf = 0; } - if (is_depth && is_stencil) { + if (blit_depth && blit_stencil) { /* Setup two samplers, one for depth and the other one for stencil. */ struct pipe_sampler_view templ; struct pipe_sampler_view *views[2]; @@ -1096,6 +1127,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, pipe->bind_vertex_elements_state(pipe, ctx->velem_state); pipe->set_framebuffer_state(pipe, &fb_state); + pipe->set_sample_mask(pipe, ~0); blitter_set_common_draw_rect_state(ctx); blitter_set_dst_dimensions(ctx, dst->width, dst->height); @@ -1183,6 +1215,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter, fb_state.cbufs[0] = dstsurf; fb_state.zsbuf = 0; pipe->set_framebuffer_state(pipe, &fb_state); + pipe->set_sample_mask(pipe, ~0); blitter_set_common_draw_rect_state(ctx); blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height); @@ -1248,6 +1281,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter, fb_state.cbufs[0] = 0; fb_state.zsbuf = dstsurf; pipe->set_framebuffer_state(pipe, &fb_state); + pipe->set_sample_mask(pipe, ~0); blitter_set_common_draw_rect_state(ctx); blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height); diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h index 2db984c8a..7600391c5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.h +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h @@ -94,6 +94,8 @@ 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; + boolean is_sample_mask_saved; + unsigned saved_sample_mask; int saved_num_sampler_states; void *saved_sampler_states[PIPE_MAX_SAMPLERS]; @@ -159,6 +161,16 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter, double depth, void *custom_dsa); /** + * Check if the blitter (with the help of the driver) can blit between + * the two resources. + * The mask is a combination of the PIPE_MASK_* flags. + * Set to PIPE_MASK_RGBAZS if unsure. + */ +boolean util_blitter_is_copy_supported(struct blitter_context *blitter, + const struct pipe_resource *dst, + const struct pipe_resource *src, + unsigned mask); +/** * Copy a block of pixels from one surface to another. * * You can copy from any color format to any other color format provided @@ -166,13 +178,6 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter, * a software fallback path is taken and both surfaces must be of the same * format. * - * The same holds for depth-stencil formats with the exception that stencil - * cannot be copied unless you set ignore_stencil to FALSE. In that case, - * a software fallback path is taken and both surfaces must be of the same - * format. If the shader stencil export is supported, stencil copy is always - * accelerated. - * - * Use pipe_screen->is_format_supported to know your options. * * These states must be saved in the blitter in addition to the state objects * already required to be saved: @@ -185,12 +190,11 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter, */ void util_blitter_copy_texture(struct blitter_context *blitter, struct pipe_resource *dst, - unsigned dstlevel, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *src, - unsigned srclevel, - const struct pipe_box *srcbox, - boolean ignore_stencil); + unsigned src_level, + const struct pipe_box *srcbox); /** * Same as util_blitter_copy_texture, but dst and src are pipe_surface and @@ -207,6 +211,9 @@ void util_blitter_copy_texture(struct blitter_context *blitter, * coordinates. The dst dimensions are supplied through pipe_surface::width * and height. * + * 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, @@ -214,7 +221,8 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter, unsigned dstx, unsigned dsty, struct pipe_sampler_view *src, const struct pipe_box *srcbox, - unsigned src_width0, unsigned src_height0); + unsigned src_width0, unsigned src_height0, + unsigned mask); /** * Helper function to initialize a view for copy_texture_view. @@ -418,6 +426,14 @@ util_blitter_save_so_targets(struct blitter_context *blitter, targets[i]); } +static INLINE void +util_blitter_save_sample_mask(struct blitter_context *blitter, + unsigned sample_mask) +{ + blitter->is_sample_mask_saved = TRUE; + blitter->saved_sample_mask = sample_mask; +} + #ifdef __cplusplus } #endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_tests.c b/mesalib/src/gallium/auxiliary/util/u_format_tests.c index d34860886..26e7acb62 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_tests.c +++ b/mesalib/src/gallium/auxiliary/util/u_format_tests.c @@ -26,6 +26,7 @@ **************************************************************************/ +#include <math.h> #include <float.h> #include "pipe/p_config.h" @@ -66,14 +67,6 @@ {{ 0, 0, 0, 0}, { 0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}} -#ifdef __GNUC__ -#define NAN __builtin_nan("") -#define INF __builtin_inf() -#else -#define NAN (0.0 / 0.0) -#define INF (1.0 / 0.0) -#endif - /** * Test cases. * @@ -911,8 +904,8 @@ util_format_test_cases[] = {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1( -NAN, 0.0, 0.0, 1.0)}, /* Inf */ - {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1( INF, 0.0, 0.0, 1.0)}, - {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( -INF, 0.0, 0.0, 1.0)}, + {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1( INFINITY, 0.0, 0.0, 1.0)}, + {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( -INFINITY, 0.0, 0.0, 1.0)}, #endif diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c index a96cf6a30..c82c52c84 100644 --- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1573,8 +1573,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_save_blend(ctx->cso); cso_save_depth_stencil_alpha(ctx->cso); cso_save_rasterizer(ctx->cso); - cso_save_samplers(ctx->cso); - cso_save_fragment_sampler_views(ctx->cso); + cso_save_sample_mask(ctx->cso); + cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); cso_save_stream_outputs(ctx->cso); cso_save_framebuffer(ctx->cso); cso_save_fragment_shader(ctx->cso); @@ -1590,6 +1591,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_set_depth_stencil_alpha(ctx->cso, is_depth ? &ctx->dsa_write_depth : &ctx->dsa_keep_depth); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); + cso_set_sample_mask(ctx->cso, ~0); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); cso_set_stream_outputs(ctx->cso, 0, NULL, 0); @@ -1675,10 +1677,10 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, */ ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel; ctx->sampler.lod_bias = (float) srcLevel; - cso_single_sampler(ctx->cso, 0, &ctx->sampler); - cso_single_sampler_done(ctx->cso); + cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler); + cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT); - cso_set_fragment_sampler_views(ctx->cso, 1, &psv); + cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &psv); /* quad coords in clip coords */ offset = set_vertex_data(ctx, @@ -1703,8 +1705,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_restore_blend(ctx->cso); cso_restore_depth_stencil_alpha(ctx->cso); cso_restore_rasterizer(ctx->cso); - cso_restore_samplers(ctx->cso); - cso_restore_fragment_sampler_views(ctx->cso); + cso_restore_sample_mask(ctx->cso); + cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT); + cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT); cso_restore_framebuffer(ctx->cso); cso_restore_fragment_shader(ctx->cso); cso_restore_vertex_shader(ctx->cso); diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c index a541a38ff..fcfff148f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_surface.c +++ b/mesalib/src/gallium/auxiliary/util/u_surface.c @@ -160,12 +160,12 @@ util_resource_copy_region(struct pipe_context *pipe, unsigned h = src_box->height; assert(src && dst); - assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) || - (src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER)); - if (!src || !dst) return; + assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) || + (src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER)); + src_format = src->format; dst_format = dst->format; |