st/mesa: pass storage_sample_count parameter into st_choose_format

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2018-06-11 15:04:11 -04:00
parent 459f05c7ec
commit 8e3d0019e1
6 changed files with 30 additions and 22 deletions

View file

@ -535,7 +535,7 @@ make_texture(struct st_context *st,
GLenum intFormat = internal_format(ctx, format, type);
pipeFormat = st_choose_format(st, intFormat, format, type,
st->internal_target, 0,
st->internal_target, 0, 0,
PIPE_BIND_SAMPLER_VIEW, FALSE);
assert(pipeFormat != PIPE_FORMAT_NONE);
}
@ -1584,7 +1584,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* srcFormat is non-renderable. Find a compatible renderable format. */
if (type == GL_DEPTH) {
srcFormat = st_choose_format(st, GL_DEPTH_COMPONENT, GL_NONE,
GL_NONE, st->internal_target, 0,
GL_NONE, st->internal_target, 0, 0,
srcBind, FALSE);
}
else {
@ -1592,27 +1592,27 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
if (util_format_is_float(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA32F, GL_NONE,
GL_NONE, st->internal_target, 0,
GL_NONE, st->internal_target, 0, 0,
srcBind, FALSE);
}
else if (util_format_is_pure_sint(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA32I, GL_NONE,
GL_NONE, st->internal_target, 0,
GL_NONE, st->internal_target, 0, 0,
srcBind, FALSE);
}
else if (util_format_is_pure_uint(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA32UI, GL_NONE,
GL_NONE, st->internal_target, 0,
GL_NONE, st->internal_target, 0, 0,
srcBind, FALSE);
}
else if (util_format_is_snorm(srcFormat)) {
srcFormat = st_choose_format(st, GL_RGBA16_SNORM, GL_NONE,
GL_NONE, st->internal_target, 0,
GL_NONE, st->internal_target, 0, 0,
srcBind, FALSE);
}
else {
srcFormat = st_choose_format(st, GL_RGBA, GL_NONE,
GL_NONE, st->internal_target, 0,
GL_NONE, st->internal_target, 0, 0,
srcBind, FALSE);
}
}

View file

@ -83,7 +83,7 @@ st_renderbuffer_alloc_sw_storage(struct gl_context * ctx,
format = PIPE_FORMAT_R16G16B16A16_SNORM;
}
else {
format = st_choose_renderbuffer_format(st, internalFormat, 0);
format = st_choose_renderbuffer_format(st, internalFormat, 0, 0);
/* Not setting gl_renderbuffer::Format here will cause
* FRAMEBUFFER_UNSUPPORTED and ValidateFramebuffer will not be called.
@ -169,7 +169,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
}
for (i = start; i <= ctx->Const.MaxSamples; i++) {
format = st_choose_renderbuffer_format(st, internalFormat, i);
format = st_choose_renderbuffer_format(st, internalFormat, i, i);
if (format != PIPE_FORMAT_NONE) {
rb->NumSamples = i;
@ -178,7 +178,7 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
}
}
} else {
format = st_choose_renderbuffer_format(st, internalFormat, 0);
format = st_choose_renderbuffer_format(st, internalFormat, 0, 0);
}
/* Not setting gl_renderbuffer::Format here will cause

View file

@ -2043,7 +2043,7 @@ st_GetTexSubImage(struct gl_context * ctx,
}
dst_format = st_choose_format(st, dst_glformat, format, type,
pipe_target, 0, bind, FALSE);
pipe_target, 0, 0, bind, FALSE);
if (dst_format == PIPE_FORMAT_NONE) {
/* unable to get an rgba format!?! */

View file

@ -2053,13 +2053,15 @@ find_supported_format(struct pipe_screen *screen,
const enum pipe_format formats[],
enum pipe_texture_target target,
unsigned sample_count,
unsigned storage_sample_count,
unsigned bindings,
boolean allow_dxt)
{
uint i;
for (i = 0; formats[i]; i++) {
if (screen->is_format_supported(screen, formats[i], target,
sample_count, sample_count, bindings)) {
sample_count, storage_sample_count,
bindings)) {
if (!allow_dxt && util_format_is_s3tc(formats[i])) {
/* we can't return a dxt format, continue searching */
continue;
@ -2164,6 +2166,7 @@ enum pipe_format
st_choose_format(struct st_context *st, GLenum internalFormat,
GLenum format, GLenum type,
enum pipe_texture_target target, unsigned sample_count,
unsigned storage_sample_count,
unsigned bindings, boolean allow_dxt)
{
struct pipe_screen *screen = st->pipe->screen;
@ -2193,7 +2196,7 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
pf = find_exact_format(internalFormat, format, type);
if (pf != PIPE_FORMAT_NONE &&
screen->is_format_supported(screen, pf, target, sample_count,
sample_count, bindings)) {
storage_sample_count, bindings)) {
goto success;
}
@ -2219,7 +2222,8 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
* which is supported by the driver.
*/
pf = find_supported_format(screen, mapping->pipeFormats,
target, sample_count, bindings,
target, sample_count,
storage_sample_count, bindings,
allow_dxt);
goto success;
}
@ -2247,7 +2251,8 @@ success:
*/
enum pipe_format
st_choose_renderbuffer_format(struct st_context *st,
GLenum internalFormat, unsigned sample_count)
GLenum internalFormat, unsigned sample_count,
unsigned storage_sample_count)
{
unsigned bindings;
if (_mesa_is_depth_or_stencil_format(internalFormat))
@ -2255,7 +2260,8 @@ st_choose_renderbuffer_format(struct st_context *st,
else
bindings = PIPE_BIND_RENDER_TARGET;
return st_choose_format(st, internalFormat, GL_NONE, GL_NONE,
PIPE_TEXTURE_2D, sample_count, bindings, FALSE);
PIPE_TEXTURE_2D, sample_count,
storage_sample_count, bindings, FALSE);
}
@ -2387,12 +2393,12 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
}
pFormat = st_choose_format(st, internalFormat, format, type,
pTarget, 0, bindings, GL_TRUE);
pTarget, 0, 0, bindings, GL_TRUE);
if (pFormat == PIPE_FORMAT_NONE && !is_renderbuffer) {
/* try choosing format again, this time without render target bindings */
pFormat = st_choose_format(st, internalFormat, format, type,
pTarget, 0, PIPE_BIND_SAMPLER_VIEW,
pTarget, 0, 0, PIPE_BIND_SAMPLER_VIEW,
GL_TRUE);
}
@ -2450,7 +2456,7 @@ st_QuerySamplesForFormat(struct gl_context *ctx, GLenum target,
/* Set sample counts in descending order. */
for (i = 16; i > 1; i--) {
format = st_choose_format(st, internalFormat, GL_NONE, GL_NONE,
PIPE_TEXTURE_2D, i, bind, FALSE);
PIPE_TEXTURE_2D, i, i, bind, FALSE);
if (format != PIPE_FORMAT_NONE) {
samples[num_sample_counts++] = i;
@ -2509,7 +2515,7 @@ st_QueryInternalFormat(struct gl_context *ctx, GLenum target,
internalFormat,
GL_NONE,
GL_NONE,
PIPE_TEXTURE_2D, 1,
PIPE_TEXTURE_2D, 0, 0,
bindings, FALSE);
if (pformat)
params[0] = internalFormat;

View file

@ -54,11 +54,13 @@ extern enum pipe_format
st_choose_format(struct st_context *st, GLenum internalFormat,
GLenum format, GLenum type,
enum pipe_texture_target target, unsigned sample_count,
unsigned storage_sample_count,
unsigned bindings, boolean allow_dxt);
extern enum pipe_format
st_choose_renderbuffer_format(struct st_context *st,
GLenum internalFormat, unsigned sample_count);
GLenum internalFormat, unsigned sample_count,
unsigned storage_sample_count);
extern enum pipe_format
st_choose_matching_format(struct st_context *st, unsigned bind,

View file

@ -415,7 +415,7 @@ st_create_color_map_texture(struct gl_context *ctx)
/* find an RGBA texture format */
format = st_choose_format(st, GL_RGBA, GL_NONE, GL_NONE,
PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW,
FALSE);
/* create texture for color map/table */