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 | |
parent | 8632626c81a09315276d7defa63092247d7fd308 (diff) |
gallium: add storage_sample_count parameter into is_format_supported
Tested-by: Dieter Nützel <[email protected]>
80 files changed, 244 insertions, 117 deletions
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c b/src/gallium/auxiliary/driver_ddebug/dd_screen.c index 5f922d884fe..a89af8a8d62 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c @@ -147,12 +147,13 @@ dd_screen_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) { struct pipe_screen *screen = dd_screen(_screen)->screen; return screen->is_format_supported(screen, format, target, sample_count, - tex_usage); + storage_sample_count, tex_usage); } static boolean diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c index 9e39e65b4d0..7de3e882398 100644 --- a/src/gallium/auxiliary/driver_noop/noop_pipe.c +++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c @@ -420,11 +420,13 @@ static boolean noop_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 pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen; - return screen->is_format_supported(screen, format, target, sample_count, usage); + return screen->is_format_supported(screen, format, target, sample_count, + storage_sample_count, usage); } static uint64_t noop_get_timestamp(struct pipe_screen *pscreen) diff --git a/src/gallium/auxiliary/driver_rbug/rbug_screen.c b/src/gallium/auxiliary/driver_rbug/rbug_screen.c index a1a77add734..693e7fab912 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_screen.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_screen.c @@ -124,6 +124,7 @@ rbug_screen_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) { struct rbug_screen *rb_screen = rbug_screen(_screen); @@ -133,6 +134,7 @@ rbug_screen_is_format_supported(struct pipe_screen *_screen, format, target, sample_count, + storage_sample_count, tex_usage); } diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c index 704b2a3c72d..b5bd3e11c46 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.c +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c @@ -225,6 +225,7 @@ trace_screen_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) { struct trace_screen *tr_scr = trace_screen(_screen); @@ -240,7 +241,7 @@ trace_screen_is_format_supported(struct pipe_screen *_screen, trace_dump_arg(uint, tex_usage); result = screen->is_format_supported(screen, format, target, sample_count, - tex_usage); + storage_sample_count, tex_usage); trace_dump_ret(bool, result); diff --git a/src/gallium/auxiliary/hud/font.c b/src/gallium/auxiliary/hud/font.c index 9fb9d7e055b..88b0349fda2 100644 --- a/src/gallium/auxiliary/hud/font.c +++ b/src/gallium/auxiliary/hud/font.c @@ -390,7 +390,7 @@ util_font_create_fixed_8x13(struct pipe_context *pipe, for (i = 0; i < ARRAY_SIZE(formats); i++) { if (screen->is_format_supported(screen, formats[i], - PIPE_TEXTURE_RECT, 0, + PIPE_TEXTURE_RECT, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { tex_format = formats[i]; break; diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 233202453ee..3dd7c102edb 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -1842,7 +1842,7 @@ hud_create(struct cso_context *cso, struct hud_context *share) hud->refcount = 1; hud->has_srgb = screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET) != 0; /* blend state */ diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c index b9eff78bf4f..2c830e81bd7 100644 --- a/src/gallium/auxiliary/postprocess/pp_init.c +++ b/src/gallium/auxiliary/postprocess/pp_init.c @@ -279,7 +279,7 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w, tmp_res.bind = PIPE_BIND_RENDER_TARGET; if (!p->screen->is_format_supported(p->screen, tmp_res.format, - tmp_res.target, 1, tmp_res.bind)) + tmp_res.target, 1, 1, tmp_res.bind)) pp_debug("Temp buffers' format fail\n"); for (i = 0; i < ppq->n_tmp; i++) { @@ -305,12 +305,12 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w, tmp_res.format = p->surf.format = PIPE_FORMAT_S8_UINT_Z24_UNORM; if (!p->screen->is_format_supported(p->screen, tmp_res.format, - tmp_res.target, 1, tmp_res.bind)) { + tmp_res.target, 1, 1, tmp_res.bind)) { tmp_res.format = p->surf.format = PIPE_FORMAT_Z24_UNORM_S8_UINT; if (!p->screen->is_format_supported(p->screen, tmp_res.format, - tmp_res.target, 1, tmp_res.bind)) + tmp_res.target, 1, 1, tmp_res.bind)) pp_debug("Temp Sbuffer format fail\n"); } diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index f003ee75fd5..fd5a55dde0a 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c @@ -243,7 +243,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n, res.depth0 = res.array_size = res.nr_samples = res.nr_storage_samples = 1; if (!ppq->p->screen->is_format_supported(ppq->p->screen, res.format, - res.target, 1, res.bind)) + res.target, 1, 1, res.bind)) pp_debug("Areamap format not supported\n"); ppq->areamaptex = ppq->p->screen->resource_create(ppq->p->screen, &res); diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index 811f1fb0773..cb06c8d81f3 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -119,7 +119,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe, if (!p->screen->is_format_supported(p->screen, PIPE_FORMAT_R32G32B32A32_FLOAT, - PIPE_BUFFER, 1, + PIPE_BUFFER, 1, 1, PIPE_BIND_VERTEX_BUFFER)) pp_debug("Vertex buf format fail\n"); diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 9a43c2f6556..ca3d221ed36 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -551,6 +551,7 @@ util_blit_pixels_tex(struct blit_state *ctx, assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format, PIPE_TEXTURE_2D, dst->texture->nr_samples, + dst->texture->nr_storage_samples, PIPE_BIND_RENDER_TARGET)); /* save state (restored below) */ diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index eadb76a109f..a9df71108b4 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1182,7 +1182,7 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) /* MSAA resolve shaders. */ for (j = 2; j < 32; j++) { if (!screen->is_format_supported(screen, PIPE_FORMAT_R32_FLOAT, - target, j, + target, j, j, PIPE_BIND_SAMPLER_VIEW)) { continue; } @@ -1539,7 +1539,8 @@ static bool is_blit_generic_supported(struct blitter_context *blitter, bind = PIPE_BIND_RENDER_TARGET; if (!screen->is_format_supported(screen, dst_format, dst->target, - dst->nr_samples, bind)) { + dst->nr_samples, dst->nr_storage_samples, + bind)) { return false; } } @@ -1550,7 +1551,8 @@ static bool is_blit_generic_supported(struct blitter_context *blitter, } if (!screen->is_format_supported(screen, src_format, src->target, - src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) { + src->nr_samples, src->nr_storage_samples, + PIPE_BIND_SAMPLER_VIEW)) { return false; } @@ -1564,6 +1566,7 @@ static bool is_blit_generic_supported(struct blitter_context *blitter, if (stencil_format != src_format && !screen->is_format_supported(screen, stencil_format, src->target, src->nr_samples, + src->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW)) { return false; } diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 3c55d9f385c..06737c58fe8 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -76,7 +76,7 @@ util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt, return TRUE; if (!screen->is_format_supported(screen, format, pt->target, - pt->nr_samples, + pt->nr_samples, pt->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW | (is_zs ? PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET))) { diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 28d0f77ebaa..fc7eb138835 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -2205,7 +2205,8 @@ tc_generate_mipmap(struct pipe_context *_pipe, bind = PIPE_BIND_RENDER_TARGET; if (!screen->is_format_supported(screen, format, res->target, - res->nr_samples, bind)) + res->nr_samples, res->nr_storage_samples, + bind)) return false; struct tc_generate_mipmap *p = diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index 39aeb87003b..746ff1085ce 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -269,7 +269,7 @@ boolean u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps, for (i = 0; i < ARRAY_SIZE(vbuf_format_fallbacks); i++) { enum pipe_format format = vbuf_format_fallbacks[i].from; - if (!screen->is_format_supported(screen, format, PIPE_BUFFER, 0, + if (!screen->is_format_supported(screen, format, PIPE_BUFFER, 0, 0, PIPE_BIND_VERTEX_BUFFER)) { caps->format_translation[format] = vbuf_format_fallbacks[i].to; fallback = TRUE; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 8a2dae34e35..9589b1e89e0 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -908,20 +908,20 @@ find_format_config(struct vl_mpeg12_decoder *dec, const struct format_config con for (i = 0; i < num_configs; ++i) { if (!screen->is_format_supported(screen, configs[i].zscan_source_format, PIPE_TEXTURE_2D, - 1, PIPE_BIND_SAMPLER_VIEW)) + 1, 1, PIPE_BIND_SAMPLER_VIEW)) continue; if (configs[i].idct_source_format != PIPE_FORMAT_NONE) { if (!screen->is_format_supported(screen, configs[i].idct_source_format, PIPE_TEXTURE_2D, - 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET)) + 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET)) continue; if (!screen->is_format_supported(screen, configs[i].mc_source_format, PIPE_TEXTURE_3D, - 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET)) + 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET)) continue; } else { if (!screen->is_format_supported(screen, configs[i].mc_source_format, PIPE_TEXTURE_2D, - 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET)) + 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET)) continue; } return &configs[i]; diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 3b97ac81af9..5b54ee1dd68 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -192,11 +192,11 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen, continue; /* we at least need to sample from it */ - if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) + if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) return false; format = vl_video_buffer_surface_format(format); - if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET)) + if (!screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET)) return false; } diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index ecff0800bf8..e85246c4778 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -746,6 +746,9 @@ Determine if a resource in the given format can be used in a specific manner. **sample_count** the number of samples. 0 and 1 mean no multisampling, the maximum allowed legal value is 32. +**storage_sample_count** the number of storage samples. This must be <= +sample_count. See the documentation of ``pipe_resource::nr_storage_samples``. + **bindings** is a bitmask of :ref:`PIPE_BIND` flags. Returns TRUE if all usages can be satisfied. 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 || diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 0439060b606..c4d6e1cc94f 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -168,6 +168,7 @@ struct pipe_screen { enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, + unsigned storage_sample_count, unsigned bindings ); /** diff --git a/src/gallium/state_trackers/clover/core/format.cpp b/src/gallium/state_trackers/clover/core/format.cpp index 57012924098..dee1872c829 100644 --- a/src/gallium/state_trackers/clover/core/format.cpp +++ b/src/gallium/state_trackers/clover/core/format.cpp @@ -152,7 +152,7 @@ namespace clover { for (auto f : formats) { if (all_of([=](const device &dev) { return dev.pipe->is_format_supported( - dev.pipe, f.second, target, 1, bindings); + dev.pipe, f.second, target, 1, 1, bindings); }, ctx.devices())) s.insert(f.first); } diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 9a22e47693b..2ac32205d9a 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1489,7 +1489,7 @@ dri2_query_dma_buf_formats(__DRIscreen *_screen, int max, int *formats, fourcc_to_pipe_format( fourcc_formats[i]), screen->target, - 0, bind)) { + 0, 0, bind)) { if (j < max) formats[j] = fourcc_formats[i]; j++; @@ -1510,7 +1510,8 @@ dri2_query_dma_buf_modifiers(__DRIscreen *_screen, int fourcc, int max, const unsigned usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; if (pscreen->query_dmabuf_modifiers != NULL && - pscreen->is_format_supported(pscreen, format, screen->target, 0, usage)) { + pscreen->is_format_supported(pscreen, format, screen->target, 0, 0, + usage)) { pscreen->query_dmabuf_modifiers(pscreen, format, max, modifiers, external_only, count); return true; diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c b/src/gallium/state_trackers/dri/dri_query_renderer.c index 80847e3d314..2417f40a6ad 100644 --- a/src/gallium/state_trackers/dri/dri_query_renderer.c +++ b/src/gallium/state_trackers/dri/dri_query_renderer.c @@ -52,7 +52,7 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param, value[0] = screen->base.screen->is_format_supported(screen->base.screen, PIPE_FORMAT_B8G8R8A8_SRGB, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET); return 0; case __DRI2_RENDERER_HAS_CONTEXT_PRIORITY: diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 87729c190a8..fe4e39b3f93 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -189,22 +189,22 @@ dri_fill_in_modes(struct dri_screen *screen) ? MSAA_VISUAL_MAX_SAMPLES : 1; pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_DEPTH_STENCIL); pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_DEPTH_STENCIL); pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_UINT, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_DEPTH_STENCIL); pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_UINT_Z24_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_DEPTH_STENCIL); pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_DEPTH_STENCIL); pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_DEPTH_STENCIL); if (pf_z16) { @@ -252,7 +252,7 @@ dri_fill_in_modes(struct dri_screen *screen) continue; if (!p_screen->is_format_supported(p_screen, pipe_formats[format], - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET)) continue; @@ -261,7 +261,7 @@ dri_fill_in_modes(struct dri_screen *screen) int samples = i > 1 ? i : 0; if (p_screen->is_format_supported(p_screen, pipe_formats[format], - PIPE_TEXTURE_2D, samples, + PIPE_TEXTURE_2D, samples, samples, PIPE_BIND_RENDER_TARGET)) { msaa_modes[num_msaa_modes++] = samples; } diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index e4c9408d0db..b560ffca9b6 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -489,7 +489,7 @@ choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil, for (i = 0; i < count; i++) { if (xmdpy->screen->is_format_supported(xmdpy->screen, formats[i], target, sample_count, - tex_usage)) { + sample_count, tex_usage)) { fmt = formats[i]; break; } @@ -892,6 +892,7 @@ XMesaVisual XMesaCreateVisual( Display *display, if (!xmdpy->screen->is_format_supported(xmdpy->screen, v->stvis.color_format, PIPE_TEXTURE_2D, num_samples, + num_samples, PIPE_BIND_RENDER_TARGET)) v->stvis.color_format = PIPE_FORMAT_NONE; diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c index 0a9034c949d..911eee6da20 100644 --- a/src/gallium/state_trackers/nine/basetexture9.c +++ b/src/gallium/state_trackers/nine/basetexture9.c @@ -557,7 +557,7 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, srgb_format = util_format_srgb(resource->format); if (sRGB && srgb_format != PIPE_FORMAT_NONE && screen->is_format_supported(screen, srgb_format, - resource->target, 0, resource->bind)) + resource->target, 0, 0, resource->bind)) templ.format = srgb_format; else templ.format = resource->format; diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index c434efb8bc7..150f5e3e05e 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -1580,6 +1580,7 @@ NineDevice9_StretchRect( struct NineDevice9 *This, user_assert(screen->is_format_supported(screen, src_res->format, src_res->target, src_res->nr_samples, + src_res->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW), D3DERR_INVALIDCALL); @@ -1705,6 +1706,7 @@ NineDevice9_StretchRect( struct NineDevice9 *This, user_assert(screen->is_format_supported(screen, dst_res->format, dst_res->target, dst_res->nr_samples, + dst_res->nr_storage_samples, zs ? PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET), D3DERR_INVALIDCALL); diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h index c8fef628276..7b68c09c47a 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.h +++ b/src/gallium/state_trackers/nine/nine_pipe.h @@ -288,7 +288,7 @@ d3d9_to_pipe_format_internal(D3DFORMAT format) #define format_check_internal(pipe_format) \ screen->is_format_supported(screen, pipe_format, target, \ - sample_count, bindings) + sample_count, sample_count, bindings) static inline enum pipe_format d3d9_to_pipe_format_checked(struct pipe_screen *screen, diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 4c6a6957703..71aa4f46ffd 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -243,7 +243,7 @@ NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This ) srgb_format = util_format_srgb(resource->format); if (srgb_format == PIPE_FORMAT_NONE || !screen->is_format_supported(screen, srgb_format, - resource->target, 0, resource->bind)) + resource->target, 0, 0, resource->bind)) srgb_format = resource->format; memset(&templ, 0, sizeof(templ)); diff --git a/src/gallium/state_trackers/va/subpicture.c b/src/gallium/state_trackers/va/subpicture.c index 981a99cec53..b213e9abb7d 100644 --- a/src/gallium/state_trackers/va/subpicture.c +++ b/src/gallium/state_trackers/va/subpicture.c @@ -218,7 +218,7 @@ vlVaAssociateSubpicture(VADriverContextP ctx, VASubpictureID subpicture, tex_temp.flags = 0; if (!drv->pipe->screen->is_format_supported( drv->pipe->screen, tex_temp.format, tex_temp.target, - tex_temp.nr_samples, tex_temp.bind)) { + tex_temp.nr_samples, tex_temp.nr_storage_samples, tex_temp.bind)) { mtx_unlock(&drv->mutex); return VA_STATUS_ERROR_ALLOCATION_FAILED; } diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c index 6b8b5a6b5d3..2c4ebe62e19 100644 --- a/src/gallium/state_trackers/vdpau/query.c +++ b/src/gallium/state_trackers/vdpau/query.c @@ -247,7 +247,7 @@ vlVdpOutputSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba mtx_lock(&dev->mutex); *is_supported = pscreen->is_format_supported ( - pscreen, format, PIPE_TEXTURE_3D, 1, + pscreen, format, PIPE_TEXTURE_3D, 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET ); if (*is_supported) { @@ -299,7 +299,7 @@ vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities(VdpDevice device, VdpRGBAFor mtx_lock(&dev->mutex); *is_supported = pscreen->is_format_supported ( - pscreen, format, PIPE_TEXTURE_2D, 1, + pscreen, format, PIPE_TEXTURE_2D, 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET ); mtx_unlock(&dev->mutex); @@ -348,19 +348,19 @@ vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities(VdpDevice device, mtx_lock(&dev->mutex); *is_supported = pscreen->is_format_supported ( - pscreen, rgba_format, PIPE_TEXTURE_2D, 1, + pscreen, rgba_format, PIPE_TEXTURE_2D, 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET ); *is_supported &= pscreen->is_format_supported ( - pscreen, index_format, PIPE_TEXTURE_2D, 1, + pscreen, index_format, PIPE_TEXTURE_2D, 1, 1, PIPE_BIND_SAMPLER_VIEW ); *is_supported &= pscreen->is_format_supported ( - pscreen, colortbl_format, PIPE_TEXTURE_1D, 1, + pscreen, colortbl_format, PIPE_TEXTURE_1D, 1, 1, PIPE_BIND_SAMPLER_VIEW ); mtx_unlock(&dev->mutex); @@ -403,7 +403,7 @@ vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities(VdpDevice device, VdpRGBAFormat mtx_lock(&dev->mutex); *is_supported = pscreen->is_format_supported ( - pscreen, rgba_format, PIPE_TEXTURE_2D, 1, + pscreen, rgba_format, PIPE_TEXTURE_2D, 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET ); @@ -447,7 +447,7 @@ vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba mtx_lock(&dev->mutex); *is_supported = pscreen->is_format_supported ( - pscreen, format, PIPE_TEXTURE_3D, 1, + pscreen, format, PIPE_TEXTURE_3D, 1, 1, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET ); if (*is_supported) { diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index b36c0c4aec2..420573b57ad 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -343,8 +343,9 @@ static inline bool CheckSurfaceParams(struct pipe_screen *screen, const struct pipe_resource *templ) { - return screen->is_format_supported( - screen, templ->format, templ->target, templ->nr_samples, templ->bind); + return screen->is_format_supported(screen, templ->format, templ->target, + templ->nr_samples, + templ->nr_storage_samples, templ->bind); } typedef struct diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index 833308d964c..d4e7a94f36d 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -254,7 +254,7 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats, for (cfmt = 0; cfmt < num_color_formats; cfmt++) { if (!screen->is_format_supported(screen, color_formats[cfmt].format, - PIPE_TEXTURE_2D, samples, + PIPE_TEXTURE_2D, samples, samples, bind_flags)) { continue; } @@ -267,6 +267,7 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats, if (!screen->is_format_supported(screen, depth->format, PIPE_TEXTURE_2D, samples, + samples, PIPE_BIND_DEPTH_STENCIL)) { continue; } diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index 1f4717056a9..ba220877c84 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -201,7 +201,7 @@ xa_ctx_srf_create(struct xa_context *ctx, struct xa_surface *dst) } if (!screen->is_format_supported(screen, dst->tex->format, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET)) return -XA_ERR_INVAL; diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c index 27497d3d659..e3311232e77 100644 --- a/src/gallium/state_trackers/xa/xa_renderer.c +++ b/src/gallium/state_trackers/xa/xa_renderer.c @@ -417,7 +417,7 @@ renderer_copy_prepare(struct xa_context *r, uint32_t fs_traits = FS_COMPOSITE; assert(screen->is_format_supported(screen, dst_surface->format, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET)); (void)screen; diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c index 3d268a17750..c046a3a7097 100644 --- a/src/gallium/state_trackers/xa/xa_tracker.c +++ b/src/gallium/state_trackers/xa/xa_tracker.c @@ -104,7 +104,7 @@ xa_get_pipe_format(struct xa_tracker *xa, enum xa_formats xa_format) break; case xa_format_a8: if (xa->screen->is_format_supported(xa->screen, PIPE_FORMAT_R8_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, stype_bind[xa_type_a] | PIPE_BIND_RENDER_TARGET)) fdesc.format = PIPE_FORMAT_R8_UNORM; @@ -134,7 +134,7 @@ xa_get_pipe_format(struct xa_tracker *xa, enum xa_formats xa_format) break; case xa_format_yuv8: if (xa->screen->is_format_supported(xa->screen, PIPE_FORMAT_R8_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, stype_bind[xa_type_yuv_component])) fdesc.format = PIPE_FORMAT_R8_UNORM; else @@ -196,7 +196,7 @@ xa_tracker_create(int drm_fd) xa_get_pipe_format(xa, xa_format); if (xa->screen->is_format_supported(xa->screen, fdesc.format, - PIPE_TEXTURE_2D, 0, bind)) { + PIPE_TEXTURE_2D, 0, 0, bind)) { if (xa->format_map[stype][0] == 0) xa->format_map[stype][0] = num_formats; xa->format_map[stype][1] = num_formats; @@ -300,7 +300,7 @@ xa_format_check_supported(struct xa_tracker *xa, bind |= PIPE_BIND_SCANOUT; if (!xa->screen->is_format_supported(xa->screen, fdesc.format, - PIPE_TEXTURE_2D, 0, bind)) + PIPE_TEXTURE_2D, 0, 0, bind)) return -XA_ERR_INVAL; return XA_ERR_NONE; @@ -470,7 +470,7 @@ xa_surface_redefine(struct xa_surface *srf, return -XA_ERR_INVAL; if (!xa->screen->is_format_supported(xa->screen, fdesc.format, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, template->bind | PIPE_BIND_RENDER_TARGET)) return -XA_ERR_INVAL; diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c index bc26976e282..7a6dc89d8d8 100644 --- a/src/gallium/state_trackers/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xvmc/subpicture.c @@ -62,14 +62,14 @@ static enum pipe_format XvIDToPipe(struct pipe_screen *screen, case FOURCC_AI44: ret = PIPE_FORMAT_R4A4_UNORM; if (!screen->is_format_supported( - screen, ret, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) + screen, ret, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) ret = PIPE_FORMAT_B4G4R4A4_UNORM; break; case FOURCC_IA44: ret = PIPE_FORMAT_A4R4_UNORM; if (!screen->is_format_supported( - screen, ret, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) + screen, ret, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) ret = PIPE_FORMAT_B4G4R4A4_UNORM; break; @@ -79,7 +79,7 @@ static enum pipe_format XvIDToPipe(struct pipe_screen *screen, } if (!screen->is_format_supported( - screen, ret, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) { + screen, ret, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { XVMC_MSG(XVMC_ERR, "[XvMC] Unsupported 2D format %s for Xv image ID 0x%08X.\n", util_format_name(ret), xvimage_id); ret = PIPE_FORMAT_NONE; } @@ -125,7 +125,7 @@ static int PipeToComponentOrder(struct pipe_screen *screen, component_order[2] = 'V'; component_order[3] = 'A'; if (!screen->is_format_supported( - screen, *palette_format, PIPE_TEXTURE_1D, 0, + screen, *palette_format, PIPE_TEXTURE_1D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { /* One of these formats better be supported... */ *palette_format = PIPE_FORMAT_B8G8R8X8_UNORM; diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c index 443451e13d2..afe5d3e9f2b 100644 --- a/src/gallium/tests/trivial/compute.c +++ b/src/gallium/tests/trivial/compute.c @@ -1131,7 +1131,7 @@ static void test_surface_ld(struct context *ctx) printf(" - %s\n", util_format_name(surface_fmts[i])); if (!ctx->screen->is_format_supported(ctx->screen, - surface_fmts[i], PIPE_TEXTURE_2D, 1, + surface_fmts[i], PIPE_TEXTURE_2D, 1, 1, PIPE_BIND_COMPUTE_RESOURCE)) { printf("(unsupported)\n"); continue; @@ -1251,7 +1251,7 @@ static void test_surface_st(struct context *ctx) printf(" - %s\n", util_format_name(surface_fmts[i])); if (!ctx->screen->is_format_supported(ctx->screen, - surface_fmts[i], PIPE_TEXTURE_2D, 1, + surface_fmts[i], PIPE_TEXTURE_2D, 1, 1, PIPE_BIND_COMPUTE_RESOURCE)) { printf("(unsupported)\n"); continue; diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 47cf7f02870..c5370c7a1b2 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -92,7 +92,7 @@ wsw_is_dt_format_supported(struct sw_winsys *ws, struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws); return wsw->screen->is_format_supported(wsw->screen, format, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET); } diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 3ef3ff34a97..807c312a5db 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -95,7 +95,7 @@ framebuffer_quantize_num_samples(struct st_context *st, unsigned num_samples) * drivers callback must be adjusted for this. */ if (screen->is_format_supported(screen, PIPE_FORMAT_NONE, - PIPE_TEXTURE_2D, msaa_mode, + PIPE_TEXTURE_2D, msaa_mode, msaa_mode, PIPE_BIND_RENDER_TARGET)) quantized_samples = msaa_mode; } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 1bfc82db43e..babb00178ae 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -564,17 +564,17 @@ init_bitmap_state(struct st_context *st) /* find a usable texture format */ if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, - st->internal_target, 0, + st->internal_target, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM; } else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, - st->internal_target, 0, + st->internal_target, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM; } else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, - st->internal_target, 0, + st->internal_target, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM; } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index bb73644753a..5a331f841de 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1475,10 +1475,12 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, if (screen->is_format_supported(screen, blit.src.format, blit.src.resource->target, blit.src.resource->nr_samples, + blit.src.resource->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, blit.dst.format, blit.dst.resource->target, blit.dst.resource->nr_samples, + blit.dst.resource->nr_storage_samples, PIPE_BIND_RENDER_TARGET)) { pipe->blit(pipe, &blit); return GL_TRUE; @@ -1578,7 +1580,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, (type == GL_COLOR ? PIPE_BIND_RENDER_TARGET : PIPE_BIND_DEPTH_STENCIL); if (!screen->is_format_supported(screen, srcFormat, st->internal_target, 0, - srcBind)) { + 0, srcBind)) { /* srcFormat is non-renderable. Find a compatible renderable format. */ if (type == GL_DEPTH) { srcFormat = st_choose_format(st, GL_DEPTH_COMPONENT, GL_NONE, diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 0db2efc01cf..d6b93c3dbe8 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -41,10 +41,12 @@ static bool is_format_supported(struct pipe_screen *screen, enum pipe_format format, - unsigned nr_samples, unsigned usage) + unsigned nr_samples, unsigned nr_storage_samples, + unsigned usage) { bool supported = screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, - nr_samples, usage); + nr_samples, nr_storage_samples, + usage); /* for sampling, some formats can be emulated.. it doesn't matter that * the surface will have a format that the driver can't cope with because @@ -55,14 +57,14 @@ is_format_supported(struct pipe_screen *screen, enum pipe_format format, if (format == PIPE_FORMAT_IYUV) { supported = screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, PIPE_TEXTURE_2D, nr_samples, - usage); + nr_storage_samples, usage); } else if (format == PIPE_FORMAT_NV12) { supported = screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, PIPE_TEXTURE_2D, nr_samples, - usage) && + nr_storage_samples, usage) && screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, PIPE_TEXTURE_2D, nr_samples, - usage); + nr_storage_samples, usage); } } @@ -91,7 +93,8 @@ st_get_egl_image(struct gl_context *ctx, GLeglImageOES image_handle, return false; } - if (!is_format_supported(screen, out->format, out->texture->nr_samples, usage)) { + if (!is_format_supported(screen, out->format, out->texture->nr_samples, + out->texture->nr_storage_samples, usage)) { /* unable to specify a texture object using the specified EGL image */ pipe_resource_reference(&out->texture, NULL); _mesa_error(ctx, GL_INVALID_OPERATION, "%s(format not supported)", error); diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index fb41b7b73cf..73414fdfa15 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -616,8 +616,10 @@ st_validate_attachment(struct gl_context *ctx, } valid = screen->is_format_supported(screen, format, - PIPE_TEXTURE_2D, - stObj->pt->nr_samples, bindings); + PIPE_TEXTURE_2D, + stObj->pt->nr_samples, + stObj->pt->nr_storage_samples, + bindings); if (!valid) { st_fbo_invalid("Invalid format"); } diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 29181216071..3e008904eff 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -112,7 +112,7 @@ try_pbo_readpixels(struct st_context *st, struct st_renderbuffer *strb, if (texture->nr_samples > 1) return false; - if (!screen->is_format_supported(screen, dst_format, PIPE_BUFFER, 0, + if (!screen->is_format_supported(screen, dst_format, PIPE_BUFFER, 0, 0, PIPE_BIND_SHADER_IMAGE)) return false; @@ -449,7 +449,7 @@ st_ReadPixels(struct gl_context *ctx, GLint x, GLint y, if (!src_format || !screen->is_format_supported(screen, src_format, src->target, - src->nr_samples, + src->nr_samples, src->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW)) { goto fallback; } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d1f060dc979..93b6b32b7e2 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -382,13 +382,13 @@ default_bindings(struct st_context *st, enum pipe_format format) else bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET; - if (screen->is_format_supported(screen, format, target, 0, bindings)) + if (screen->is_format_supported(screen, format, target, 0, 0, bindings)) return bindings; else { /* Try non-sRGB. */ format = util_format_linear(format); - if (screen->is_format_supported(screen, format, target, 0, bindings)) + if (screen->is_format_supported(screen, format, target, 0, 0, bindings)) return bindings; else return PIPE_BIND_SAMPLER_VIEW; @@ -1343,13 +1343,13 @@ try_pbo_upload(struct gl_context *ctx, GLuint dims, if (dst_format != orig_dst_format && !screen->is_format_supported(screen, dst_format, PIPE_TEXTURE_2D, 0, - PIPE_BIND_RENDER_TARGET)) { + 0, PIPE_BIND_RENDER_TARGET)) { return false; } } if (!src_format || - !screen->is_format_supported(screen, src_format, PIPE_BUFFER, 0, + !screen->is_format_supported(screen, src_format, PIPE_BUFFER, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { return false; } @@ -1494,7 +1494,8 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, if (!dst_format || !screen->is_format_supported(screen, dst_format, dst->target, - dst->nr_samples, bind)) { + dst->nr_samples, dst->nr_storage_samples, + bind)) { goto fallback; } @@ -1738,13 +1739,14 @@ st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims, goto fallback; } - if (!screen->is_format_supported(screen, copy_format, PIPE_BUFFER, 0, + if (!screen->is_format_supported(screen, copy_format, PIPE_BUFFER, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { goto fallback; } if (!screen->is_format_supported(screen, copy_format, dst->target, - dst->nr_samples, PIPE_BIND_RENDER_TARGET)) { + dst->nr_samples, dst->nr_storage_samples, + PIPE_BIND_RENDER_TARGET)) { goto fallback; } @@ -1939,7 +1941,7 @@ st_GetTexSubImage(struct gl_context * ctx, if (!src_format || !screen->is_format_supported(screen, src_format, src->target, - src->nr_samples, + src->nr_samples, src->nr_storage_samples, PIPE_BIND_SAMPLER_VIEW)) { goto fallback; } @@ -2013,25 +2015,25 @@ st_GetTexSubImage(struct gl_context * ctx, break; case PIPE_FORMAT_ETC2_R11_UNORM: if (!screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, - pipe_target, 0, bind)) + pipe_target, 0, 0, bind)) goto fallback; dst_glformat = GL_R16; break; case PIPE_FORMAT_ETC2_R11_SNORM: if (!screen->is_format_supported(screen, PIPE_FORMAT_R16_SNORM, - pipe_target, 0, bind)) + pipe_target, 0, 0, bind)) goto fallback; dst_glformat = GL_R16_SNORM; break; case PIPE_FORMAT_ETC2_RG11_UNORM: if (!screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, - pipe_target, 0, bind)) + pipe_target, 0, 0, bind)) goto fallback; dst_glformat = GL_RG16; break; case PIPE_FORMAT_ETC2_RG11_SNORM: if (!screen->is_format_supported(screen, PIPE_FORMAT_R16G16_SNORM, - pipe_target, 0, bind)) + pipe_target, 0, 0, bind)) goto fallback; dst_glformat = GL_RG16_SNORM; break; @@ -2437,7 +2439,8 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, if (!dst_format || !screen->is_format_supported(screen, dst_format, stImage->pt->target, - stImage->pt->nr_samples, bind)) { + stImage->pt->nr_samples, + stImage->pt->nr_storage_samples, bind)) { goto fallback; } @@ -2775,7 +2778,7 @@ st_texture_create_from_memory(struct st_context *st, (int) target, util_format_name(format), last_level); assert(format); - assert(screen->is_format_supported(screen, format, target, 0, + assert(screen->is_format_supported(screen, format, target, 0, 0, PIPE_BIND_SAMPLER_VIEW)); memset(&pt, 0, sizeof(pt)); @@ -2848,7 +2851,7 @@ st_texture_storage(struct gl_context *ctx, for (; num_samples <= ctx->Const.MaxSamples; num_samples++) { if (screen->is_format_supported(screen, fmt, ptarget, - num_samples, + num_samples, num_samples, PIPE_BIND_SAMPLER_VIEW)) { /* Update the sample count in gl_texture_image as well. */ texImage->NumSamples = num_samples; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index c124793fa40..34bfb845bb0 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -433,14 +433,14 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT); st->has_shader_model3 = screen->get_param(screen, PIPE_CAP_SM3); st->has_etc1 = screen->is_format_supported(screen, PIPE_FORMAT_ETC1_RGB8, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW); st->has_etc2 = screen->is_format_supported(screen, PIPE_FORMAT_ETC2_RGB8, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW); st->has_astc_2d_ldr = screen->is_format_supported(screen, PIPE_FORMAT_ASTC_4x4_SRGB, - PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW); + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW); st->prefer_blit_based_texture_transfer = screen->get_param(screen, PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER); st->force_persample_in_shader = diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 2ec47581c50..dbaf7f6f8fe 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -559,7 +559,7 @@ init_format_extensions(struct pipe_screen *screen, /* Examine each format in the list. */ for (j = 0; j < num_formats && mapping[i].format[j]; j++) { if (screen->is_format_supported(screen, mapping[i].format[j], - target, 0, bind_flags)) { + target, 0, 0, bind_flags)) { num_supported++; } } @@ -592,7 +592,7 @@ get_max_samples_for_formats(struct pipe_screen *screen, for (i = max_samples; i > 0; --i) { for (f = 0; f < num_formats; f++) { if (screen->is_format_supported(screen, formats[f], - PIPE_TEXTURE_2D, i, bind)) { + PIPE_TEXTURE_2D, i, i, bind)) { return i; } } @@ -1227,22 +1227,22 @@ void st_init_extensions(struct pipe_screen *screen, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS) >= 16 && /* Requirements for ETC2 emulation. */ screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_R16_SNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW) && screen->is_format_supported(screen, PIPE_FORMAT_R16G16_SNORM, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) { extensions->ARB_ES3_compatibility = GL_TRUE; } diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index afe810f4d15..c2535e85324 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -65,7 +65,7 @@ st_mesa_format_to_pipe_format(const struct st_context *st, struct pipe_screen *screen = st->pipe->screen; bool has_bgra_srgb = screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB, - PIPE_TEXTURE_2D, 0, + PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW); switch (mesaFormat) { @@ -2059,7 +2059,7 @@ find_supported_format(struct pipe_screen *screen, uint i; for (i = 0; formats[i]; i++) { if (screen->is_format_supported(screen, formats[i], target, - sample_count, bindings)) { + sample_count, sample_count, bindings)) { if (!allow_dxt && util_format_is_s3tc(formats[i])) { /* we can't return a dxt format, continue searching */ continue; @@ -2192,8 +2192,8 @@ st_choose_format(struct st_context *st, GLenum internalFormat, /* search for exact matches */ pf = find_exact_format(internalFormat, format, type); if (pf != PIPE_FORMAT_NONE && - screen->is_format_supported(screen, pf, - target, sample_count, bindings)) { + screen->is_format_supported(screen, pf, target, sample_count, + sample_count, bindings)) { goto success; } @@ -2290,8 +2290,8 @@ st_choose_matching_format(struct st_context *st, unsigned bind, st_mesa_format_to_pipe_format(st, mesa_format); if (format && - screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, - bind)) { + screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, + 0, 0, bind)) { return format; } /* It's unlikely to find 2 matching Mesa formats. */ diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index d6901c96eb0..69286b57916 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -472,6 +472,7 @@ st_framebuffer_create(struct st_context *st, st_pipe_format_to_mesa_format(srgb_format) != MESA_FORMAT_NONE && screen->is_format_supported(screen, srgb_format, PIPE_TEXTURE_2D, stfbi->visual->samples, + stfbi->visual->samples, (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_RENDER_TARGET))) mode.sRGBCapable = GL_TRUE; diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 09314519d48..5da98bd338f 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -79,7 +79,7 @@ st_texture_create(struct st_context *st, (int) target, util_format_name(format), last_level); assert(format); - assert(screen->is_format_supported(screen, format, target, 0, + assert(screen->is_format_supported(screen, format, target, 0, 0, PIPE_BIND_SAMPLER_VIEW)); memset(&pt, 0, sizeof(pt)); |