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/mesa | |
parent | 8632626c81a09315276d7defa63092247d7fd308 (diff) |
gallium: add storage_sample_count parameter into is_format_supported
Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_atom_framebuffer.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_eglimage.c | 15 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_readpixels.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 33 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 16 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 12 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_manager.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_texture.c | 2 |
12 files changed, 59 insertions, 48 deletions
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)); |