mesa: add storageSamples parameter to renderbuffer functions
authorMarek Olšák <marek.olsak@amd.com>
Mon, 11 Jun 2018 19:26:41 +0000 (15:26 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 4 Aug 2018 06:46:55 +0000 (02:46 -0400)
It's just passed to other functions but otherwise unused.
It will be used in following commits.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/common/meta.c
src/mesa/main/fbobject.c
src/mesa/main/fbobject.h
src/mesa/main/multisample.c
src/mesa/main/multisample.h
src/mesa/main/teximage.c

index 6b1713e3b1ca61de168adc351bc7928f3f7b2f61..04752e0e87561433da698a1355a5088dd1b1a470 100644 (file)
@@ -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.
index cfe2174ef125f7cddcd0f2c6f3f42777229857ed..edafdd011aa07c5724ba4114e05a83631bd2d7e5 100644 (file)
@@ -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");
 }
 
index 5ba62d6cb1a85e65c95a00b4c52685d33c4e5710..0299781b1e53e099ff4d677b5c2449ad1bfdd6d1 100644 (file)
@@ -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);
index f93a18832da5e0976bccdc46fa91fd8a30e15acb..4341a5918e46f96f3eb7a6cf2f3881cf3d4fea56 100644 (file)
@@ -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:
index a7cd2918d7a95008df0e75f9bda9c53696a5af9a..49683cacdc9e741f6c0b39794d8fcb8365d46a2a 100644 (file)
@@ -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
index 948c7df0511db142827d51e3b6f27a44d46a0836..730ec88843153e7043e5072f2951aa928475cc47 100644 (file)
@@ -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: