diff options
author | Marek Olšák <[email protected]> | 2018-05-23 18:46:19 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-07-31 18:28:41 -0400 |
commit | 966f155623e5a626f1d788af7e0f602cdcee6993 (patch) | |
tree | c3ae4f7021a386abcf2c04cba7ca7ac9cca582bc /src/gallium/drivers | |
parent | 8632626c81a09315276d7defa63092247d7fd308 (diff) |
gallium: add storage_sample_count parameter into is_format_supported
Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
31 files changed, 101 insertions, 6 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index d4abf99947e..35707e60445 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -534,7 +534,9 @@ static boolean etna_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, - unsigned sample_count, unsigned usage) + unsigned sample_count, + unsigned storage_sample_count, + unsigned usage) { struct etna_screen *screen = etna_screen(pscreen); unsigned allowed = 0; @@ -547,6 +549,9 @@ etna_screen_is_format_supported(struct pipe_screen *pscreen, target != PIPE_TEXTURE_RECT) return FALSE; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (usage & PIPE_BIND_RENDER_TARGET) { /* if render target, must be RS-supported format */ if (translate_rs_format(format) != ETNA_NO_MATCH) { diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c index 4fdf6914ab2..2f701ddaa2f 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_screen.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_screen.c @@ -38,6 +38,7 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { unsigned retval = 0; @@ -49,6 +50,9 @@ fd2_screen_is_format_supported(struct pipe_screen *pscreen, return FALSE; } + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + /* TODO figure out how to render to other formats.. */ if ((usage & PIPE_BIND_RENDER_TARGET) && ((format != PIPE_FORMAT_B5G6R5_UNORM) && diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c index 366f07ef34b..a1c46684d4b 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_screen.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_screen.c @@ -39,6 +39,7 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { unsigned retval = 0; @@ -50,6 +51,9 @@ fd3_screen_is_format_supported(struct pipe_screen *pscreen, return FALSE; } + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if ((usage & PIPE_BIND_VERTEX_BUFFER) && (fd3_pipe2vtx(format) != (enum a3xx_vtx_fmt)~0)) { retval |= PIPE_BIND_VERTEX_BUFFER; diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c index 30124e4485d..bfec76cab62 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c @@ -39,6 +39,7 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { unsigned retval = 0; @@ -50,6 +51,9 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen, return FALSE; } + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if ((usage & PIPE_BIND_VERTEX_BUFFER) && (fd4_pipe2vtx(format) != (enum a4xx_vtx_fmt)~0)) { retval |= PIPE_BIND_VERTEX_BUFFER; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c index 37095be7536..7d8d2b3e5b8 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c @@ -54,6 +54,7 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { unsigned retval = 0; @@ -65,6 +66,9 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen, return FALSE; } + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if ((usage & PIPE_BIND_VERTEX_BUFFER) && (fd5_pipe2vtx(format) != (enum a5xx_vtx_fmt)~0)) { retval |= PIPE_BIND_VERTEX_BUFFER; diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 8147ff57a99..3fbf50003e9 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -148,6 +148,7 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc, */ if (!pctx->screen->is_format_supported(pctx->screen, prsc->format, prsc->target, prsc->nr_samples, + prsc->nr_storage_samples, PIPE_BIND_RENDER_TARGET)) fallback = true; diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 132a9fce034..dda7c5baee5 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -462,6 +462,7 @@ i915_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned tex_usage) { static const enum pipe_format tex_supported[] = { @@ -517,6 +518,9 @@ i915_is_format_supported(struct pipe_screen *screen, if (sample_count > 1) return FALSE; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if(tex_usage & PIPE_BIND_DEPTH_STENCIL) list = depth_supported; else if (tex_usage & PIPE_BIND_RENDER_TARGET) diff --git a/src/gallium/drivers/i915/i915_screen.h b/src/gallium/drivers/i915/i915_screen.h index 3be941a1561..c58055ab836 100644 --- a/src/gallium/drivers/i915/i915_screen.h +++ b/src/gallium/drivers/i915/i915_screen.h @@ -70,6 +70,7 @@ i915_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned tex_usage); #endif /* I915_SCREEN_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 0d0a3454375..261bca907a6 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -455,6 +455,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bind) { struct llvmpipe_screen *screen = llvmpipe_screen(_screen); @@ -478,6 +479,9 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, if (sample_count > 1) return FALSE; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (bind & PIPE_BIND_RENDER_TARGET) { if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) { /* this is a lie actually other formats COULD exist where we would fail */ diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index bddb2e6a385..556bd9bbbbe 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -415,6 +415,7 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bindings) { if (sample_count > nv30_screen(pscreen)->max_sample_count) @@ -423,6 +424,9 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen, if (!(0x00000017 & (1 << sample_count))) return false; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + /* shared is always supported */ bindings &= ~PIPE_BIND_SHARED; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 9f8bb46507a..cea6818bc9a 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -46,6 +46,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bindings) { if (sample_count > 8) @@ -55,6 +56,9 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, if (sample_count == 8 && util_format_get_blocksizebits(format) >= 128) return false; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + switch (format) { case PIPE_FORMAT_Z16_UNORM: if (nv50_screen(pscreen)->tesla->oclass < NVA0_3D_CLASS) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c index 7f32900a6e9..2cbbdc0cc35 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_shader_state.c @@ -185,6 +185,7 @@ nv50_fragprog_validate(struct nv50_context *nv50) fb->cbufs[0]->format, fb->cbufs[0]->texture->target, fb->cbufs[0]->texture->nr_samples, + fb->cbufs[0]->texture->nr_storage_samples, PIPE_BIND_BLENDABLE); /* If we already have alphatest code, we have to keep updating * it. However we only have to have different code if the current RT0 is diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index a206db38b32..daa4edb0dca 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -42,6 +42,7 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bindings) { const struct util_format_description *desc = util_format_description(format); @@ -51,6 +52,9 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen, if (!(0x117 & (1 << sample_count))) /* 0, 1, 2, 4 or 8 */ return false; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + /* Short-circuit the rest of the logic -- this is used by the state tracker * to determine valid MS levels in a no-attachments scenario. */ diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index bc497757a93..01fccfbe7ed 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -574,10 +574,10 @@ static void r300_resource_copy_region(struct pipe_context *pipe, /* Handle non-renderable plain formats. */ if (layout == UTIL_FORMAT_LAYOUT_PLAIN && (!screen->is_format_supported(screen, src_templ.format, src->target, - src->nr_samples, + src->nr_samples, src->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW) || !screen->is_format_supported(screen, dst_templ.format, dst->target, - dst->nr_samples, + dst->nr_samples, dst->nr_storage_samples, PIPE_BIND_RENDER_TARGET))) { switch (util_format_get_blocksize(dst_templ.format)) { case 1: @@ -644,9 +644,11 @@ static void r300_resource_copy_region(struct pipe_context *pipe, /* Fallback for textures. */ if (!screen->is_format_supported(screen, dst_templ.format, dst->target, dst->nr_samples, + dst->nr_storage_samples, PIPE_BIND_RENDER_TARGET) || !screen->is_format_supported(screen, src_templ.format, src->target, src->nr_samples, + src->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW)) { assert(0 && "this shouldn't happen, update r300_is_blit_supported"); util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 06168090829..046d68c0b59 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -591,6 +591,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { uint32_t retval = 0; @@ -616,6 +617,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, format == PIPE_FORMAT_R16G16B16X16_FLOAT; const struct util_format_description *desc; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + /* Check multisampling support. */ switch (sample_count) { case 0: diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 7f0d451156c..57e81e30c27 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -243,6 +243,7 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { struct r600_screen *rscreen = (struct r600_screen*)screen; @@ -253,6 +254,9 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen, return FALSE; } + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (sample_count > 1) { if (!rscreen->has_msaa) return FALSE; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 08d9e6b0264..6204e3c557b 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -706,6 +706,7 @@ boolean evergreen_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage); void evergreen_init_color_surface(struct r600_context *rctx, struct r600_surface *surf); @@ -762,6 +763,7 @@ boolean r600_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage); void r600_update_db_shader_control(struct r600_context * rctx); void r600_setup_scratch_buffers(struct r600_context *rctx); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 6af1fc4b8e4..c26a38d9264 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -162,6 +162,7 @@ boolean r600_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { struct r600_screen *rscreen = (struct r600_screen*)screen; @@ -172,6 +173,9 @@ boolean r600_is_format_supported(struct pipe_screen *screen, return FALSE; } + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (sample_count > 1) { if (!rscreen->has_msaa) return FALSE; diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index f3b9eb11159..9e2d5c7fc9e 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -1636,7 +1636,7 @@ static void r600_clear_texture(struct pipe_context *pipe, desc->unpack_rgba_float(color.f, 0, data, 0, 1, 1); if (screen->is_format_supported(screen, tex->format, - tex->target, 0, + tex->target, 0, 0, PIPE_BIND_RENDER_TARGET)) { pipe->clear_render_target(pipe, sf, &color, box->x, box->y, diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c index 23c9962408c..e614ab52423 100644 --- a/src/gallium/drivers/radeonsi/si_clear.c +++ b/src/gallium/drivers/radeonsi/si_clear.c @@ -736,7 +736,7 @@ static void si_clear_texture(struct pipe_context *pipe, desc->unpack_rgba_float(color.f, 0, data, 0, 1, 1); if (screen->is_format_supported(screen, tex->format, - tex->target, 0, + tex->target, 0, 0, PIPE_BIND_RENDER_TARGET)) { si_clear_render_target(pipe, sf, &color, box->x, box->y, diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 7bbb1f63280..fc5d63f02d3 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2132,6 +2132,7 @@ static boolean si_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { struct si_screen *sscreen = (struct si_screen *)screen; @@ -2149,6 +2150,9 @@ static boolean si_is_format_supported(struct pipe_screen *screen, if (usage & PIPE_BIND_SHADER_IMAGE) return false; + if (sample_count != storage_sample_count) + return false; + switch (sample_count) { case 2: case 4: diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 207ecc755bb..302bebfc396 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -394,6 +394,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bind) { struct sw_winsys *winsys = softpipe_screen(screen)->winsys; @@ -409,6 +410,9 @@ softpipe_is_format_supported( struct pipe_screen *screen, target == PIPE_TEXTURE_CUBE || target == PIPE_TEXTURE_CUBE_ARRAY); + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + format_desc = util_format_description(format); if (!format_desc) return FALSE; diff --git a/src/gallium/drivers/svga/svga_format.c b/src/gallium/drivers/svga/svga_format.c index c9adee11afb..0b202600c20 100644 --- a/src/gallium/drivers/svga/svga_format.c +++ b/src/gallium/drivers/svga/svga_format.c @@ -2082,6 +2082,7 @@ svga_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bindings) { struct svga_screen *ss = svga_screen(screen); @@ -2091,6 +2092,9 @@ svga_is_format_supported(struct pipe_screen *screen, assert(bindings); + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (sample_count > 1) { /* In ms_samples, if bit N is set it means that we support * multisample with N+1 samples per pixel. diff --git a/src/gallium/drivers/svga/svga_format.h b/src/gallium/drivers/svga/svga_format.h index c063589cafe..11e7e41e506 100644 --- a/src/gallium/drivers/svga/svga_format.h +++ b/src/gallium/drivers/svga/svga_format.h @@ -127,6 +127,7 @@ svga_is_format_supported(struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bindings); diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c index e234ef58715..d1287178c56 100644 --- a/src/gallium/drivers/svga/svga_pipe_clear.c +++ b/src/gallium/drivers/svga/svga_pipe_clear.c @@ -422,6 +422,7 @@ svga_clear_texture(struct pipe_context *pipe, pipe->screen->is_format_supported(pipe->screen, rtv->format, rtv->texture->target, rtv->texture->nr_samples, + rtv->texture->nr_storage_samples, PIPE_BIND_RENDER_TARGET)) { /* clear with quad drawing */ util_blitter_save_framebuffer(svga->blitter, diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 71b8ebe7d42..068862bb780 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -1040,6 +1040,7 @@ svga_texture_create(struct pipe_screen *screen, if (screen->is_format_supported(screen, template->format, template->target, template->nr_samples, + template->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW)) { bindings |= PIPE_BIND_SAMPLER_VIEW; } @@ -1054,6 +1055,7 @@ svga_texture_create(struct pipe_screen *screen, if (screen->is_format_supported(screen, template->format, template->target, template->nr_samples, + template->nr_storage_samples, PIPE_BIND_RENDER_TARGET)) { bindings |= PIPE_BIND_RENDER_TARGET; } @@ -1064,6 +1066,7 @@ svga_texture_create(struct pipe_screen *screen, if (screen->is_format_supported(screen, template->format, template->target, template->nr_samples, + template->nr_storage_samples, PIPE_BIND_DEPTH_STENCIL)) { bindings |= PIPE_BIND_DEPTH_STENCIL; } diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index 19d6f442c53..fa232b6838b 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -85,6 +85,7 @@ swr_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bind) { struct swr_screen *screen = swr_screen(_screen); @@ -100,6 +101,9 @@ swr_is_format_supported(struct pipe_screen *_screen, || target == PIPE_TEXTURE_CUBE || target == PIPE_TEXTURE_CUBE_ARRAY); + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + format_desc = util_format_description(format); if (!format_desc) return FALSE; diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c index 138060a249d..034ea271eec 100644 --- a/src/gallium/drivers/tegra/tegra_screen.c +++ b/src/gallium/drivers/tegra/tegra_screen.c @@ -132,12 +132,14 @@ tegra_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { struct tegra_screen *screen = to_tegra_screen(pscreen); return screen->gpu->is_format_supported(screen->gpu, format, target, - sample_count, usage); + sample_count, storage_sample_count, + usage); } static boolean diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index b274f2de5a8..2e743851bea 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -441,10 +441,14 @@ v3d_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { struct v3d_screen *screen = v3d_screen(pscreen); + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (sample_count > 1 && sample_count != VC5_MAX_SAMPLES) return FALSE; diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c index 1bd60d10842..646e7fa7231 100644 --- a/src/gallium/drivers/vc4/vc4_screen.c +++ b/src/gallium/drivers/vc4/vc4_screen.c @@ -480,10 +480,14 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned usage) { struct vc4_screen *screen = vc4_screen(pscreen); + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + if (sample_count > 1 && sample_count != VC4_MAX_SAMPLES) return FALSE; diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index cfa0e8ba7d4..1947c6e4880 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -475,12 +475,16 @@ virgl_is_format_supported( struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bind) { struct virgl_screen *vscreen = virgl_screen(screen); const struct util_format_description *format_desc; int i; + if (MAX2(1, sample_count) != MAX2(1, storage_sample_count)) + return false; + assert(target == PIPE_BUFFER || target == PIPE_TEXTURE_1D || target == PIPE_TEXTURE_1D_ARRAY || |