From: Marek Olšák Date: Mon, 11 Jun 2018 19:26:41 +0000 (-0400) Subject: mesa: add storageSamples parameter to renderbuffer functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d115056d3d847e524dead44e9ff255a3cf8127e;p=mesa.git mesa: add storageSamples parameter to renderbuffer functions It's just passed to other functions but otherwise unused. It will be used in following commits. Reviewed-by: Brian Paul --- diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 6b1713e3b1c..04752e0e875 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -3079,7 +3079,7 @@ decompress_texture_image(struct gl_context *ctx, /* alloc dest surface */ if (width > decompress_fbo->Width || height > decompress_fbo->Height) { _mesa_renderbuffer_storage(ctx, decompress_fbo->rb, rbFormat, - width, height, 0); + width, height, 0, 0); /* Do the full completeness check to recompute * ctx->DrawBuffer->Width/Height. diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index cfe2174ef12..edafdd011aa 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -2216,7 +2216,8 @@ invalidate_rb(GLuint key, void *data, void *userData) void _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLsizei width, - GLsizei height, GLsizei samples) + GLsizei height, GLsizei samples, + GLsizei storageSamples) { const GLenum baseFormat = _mesa_base_fbo_format(ctx, internalFormat); @@ -2227,7 +2228,8 @@ _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, if (samples != 0) { assert(samples > 0); assert(_mesa_check_sample_count(ctx, GL_RENDERBUFFER, - internalFormat, samples) == GL_NO_ERROR); + internalFormat, samples, + storageSamples) == GL_NO_ERROR); } FLUSH_VERTICES(ctx, _NEW_BUFFERS); @@ -2279,7 +2281,8 @@ _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, static void renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLsizei width, - GLsizei height, GLsizei samples, const char *func) + GLsizei height, GLsizei samples, GLsizei storageSamples, + const char *func) { GLenum baseFormat; GLenum sample_count_error; @@ -2306,30 +2309,34 @@ renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, if (samples == NO_SAMPLES) { /* NumSamples == 0 indicates non-multisampling */ samples = 0; + storageSamples = 0; } else { /* check the sample count; * note: driver may choose to use more samples than what's requested */ sample_count_error = _mesa_check_sample_count(ctx, GL_RENDERBUFFER, - internalFormat, samples); + internalFormat, samples, storageSamples); /* Section 2.5 (GL Errors) of OpenGL 3.0 specification, page 16: * * "If a negative number is provided where an argument of type sizei or * sizeiptr is specified, the error INVALID VALUE is generated." */ - if (samples < 0) { + if (samples < 0 || storageSamples < 0) { sample_count_error = GL_INVALID_VALUE; } if (sample_count_error != GL_NO_ERROR) { - _mesa_error(ctx, sample_count_error, "%s(samples=%d)", func, samples); + _mesa_error(ctx, sample_count_error, + "%s(samples=%d, storageSamples=%d)", func, samples, + storageSamples); return; } } - _mesa_renderbuffer_storage(ctx, rb, internalFormat, width, height, samples); + _mesa_renderbuffer_storage(ctx, rb, internalFormat, width, height, samples, + storageSamples); } /** @@ -2339,7 +2346,7 @@ renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, static void renderbuffer_storage_named(GLuint renderbuffer, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei samples, - const char *func) + GLsizei storageSamples, const char *func) { GET_CURRENT_CONTEXT(ctx); @@ -2364,7 +2371,8 @@ renderbuffer_storage_named(GLuint renderbuffer, GLenum internalFormat, return; } - renderbuffer_storage(ctx, rb, internalFormat, width, height, samples, func); + renderbuffer_storage(ctx, rb, internalFormat, width, height, samples, + storageSamples, func); } /** @@ -2375,7 +2383,7 @@ renderbuffer_storage_named(GLuint renderbuffer, GLenum internalFormat, static void renderbuffer_storage_target(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei samples, - const char *func) + GLsizei storageSamples, const char *func) { GET_CURRENT_CONTEXT(ctx); @@ -2406,7 +2414,7 @@ renderbuffer_storage_target(GLenum target, GLenum internalFormat, } renderbuffer_storage(ctx, ctx->CurrentRenderbuffer, internalFormat, width, - height, samples, func); + height, samples, storageSamples, func); } @@ -2469,7 +2477,7 @@ _mesa_RenderbufferStorage(GLenum target, GLenum internalFormat, * a token value here just for error reporting purposes. */ renderbuffer_storage_target(target, internalFormat, width, height, - NO_SAMPLES, "glRenderbufferStorage"); + NO_SAMPLES, 0, "glRenderbufferStorage"); } @@ -2479,7 +2487,8 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLsizei width, GLsizei height) { renderbuffer_storage_target(target, internalFormat, width, height, - samples, "glRenderbufferStorageMultisample"); + samples, samples, + "glRenderbufferStorageMultisample"); } @@ -2500,7 +2509,7 @@ _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, break; } - renderbuffer_storage_target(target, internalFormat, width, height, 0, + renderbuffer_storage_target(target, internalFormat, width, height, 0, 0, "glRenderbufferStorageEXT"); } @@ -2513,7 +2522,7 @@ _mesa_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, * a token value here just for error reporting purposes. */ renderbuffer_storage_named(renderbuffer, internalformat, width, height, - NO_SAMPLES, "glNamedRenderbufferStorage"); + NO_SAMPLES, 0, "glNamedRenderbufferStorage"); } void GLAPIENTRY @@ -2522,7 +2531,7 @@ _mesa_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLsizei width, GLsizei height) { renderbuffer_storage_named(renderbuffer, internalformat, width, height, - samples, + samples, samples, "glNamedRenderbufferStorageMultisample"); } diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index 5ba62d6cb1a..0299781b1e5 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -95,7 +95,8 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, extern void _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLsizei width, - GLsizei height, GLsizei samples); + GLsizei height, GLsizei samples, + GLsizei storageSamples); extern void _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb); diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index f93a18832da..4341a5918e4 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -209,7 +209,8 @@ _mesa_MinSampleShading(GLclampf value) */ GLenum _mesa_check_sample_count(struct gl_context *ctx, GLenum target, - GLenum internalFormat, GLsizei samples) + GLenum internalFormat, GLsizei samples, + GLsizei storageSamples) { /* Section 4.4 (Framebuffer objects), page 198 of the OpenGL ES 3.0.0 * specification says: diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h index a7cd2918d7a..49683cacdc9 100644 --- a/src/mesa/main/multisample.h +++ b/src/mesa/main/multisample.h @@ -55,6 +55,7 @@ _mesa_MinSampleShading(GLclampf value); extern GLenum _mesa_check_sample_count(struct gl_context *ctx, GLenum target, - GLenum internalFormat, GLsizei samples); + GLenum internalFormat, GLsizei samples, + GLsizei storageSamples); #endif diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 948c7df0511..730ec888431 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -5850,7 +5850,7 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, } sample_count_error = _mesa_check_sample_count(ctx, target, - internalformat, samples); + internalformat, samples, samples); samplesOK = sample_count_error == GL_NO_ERROR; /* Page 254 of OpenGL 4.4 spec says: