Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-07-02 18:28:30 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-02 18:28:41 +0300
commit35481fde40c78e004230d7909e7b7d83438cc64e (patch)
tree639b68a64d33358749333f7dbdfd6829c7b06b9b /source/blender/gpu
parenta4fe8ef236b65210ef04945be7f3936757015b7f (diff)
GPUOffScreen: Remove the sample parameter
This is because the DRW module is no longer compatible with drawing using MSAA. This also change the Python API.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_framebuffer.h2
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c52
2 files changed, 6 insertions, 48 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index 213cbe30794..fcbe3ef2a78 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -195,7 +195,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb,
*/
GPUOffScreen *GPU_offscreen_create(
- int width, int height, int samples, bool depth, bool high_bitdepth, char err_out[256]);
+ int width, int height, bool depth, bool high_bitdepth, char err_out[256]);
void GPU_offscreen_free(GPUOffScreen *ofs);
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save);
void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore);
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 5af9364b92c..3e806e1a982 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -876,7 +876,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs)
}
GPUOffScreen *GPU_offscreen_create(
- int width, int height, int samples, bool depth, bool high_bitdepth, char err_out[256])
+ int width, int height, bool depth, bool high_bitdepth, char err_out[256])
{
GPUOffScreen *ofs;
@@ -887,12 +887,11 @@ GPUOffScreen *GPU_offscreen_create(
height = max_ii(1, height);
width = max_ii(1, width);
- ofs->color = GPU_texture_create_2d_multisample(
- width, height, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL, samples, err_out);
+ ofs->color = GPU_texture_create_2d(
+ width, height, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL, err_out);
if (depth) {
- ofs->depth = GPU_texture_create_2d_multisample(
- width, height, GPU_DEPTH24_STENCIL8, NULL, samples, err_out);
+ ofs->depth = GPU_texture_create_2d(width, height, GPU_DEPTH24_STENCIL8, NULL, err_out);
}
if ((depth && !ofs->depth) || !ofs->color) {
@@ -993,48 +992,7 @@ void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels)
BLI_assert(type == GL_UNSIGNED_BYTE || type == GL_FLOAT);
- if (GPU_texture_target(ofs->color) == GL_TEXTURE_2D_MULTISAMPLE) {
- /* For a multi-sample texture,
- * we need to create an intermediate buffer to blit to,
- * before its copied using 'glReadPixels' */
- GLuint fbo_blit = 0;
- GLuint tex_blit = 0;
-
- /* create texture for new 'fbo_blit' */
- glGenTextures(1, &tex_blit);
- glBindTexture(GL_TEXTURE_2D, tex_blit);
- glTexImage2D(
- GL_TEXTURE_2D, 0, (type == GL_FLOAT) ? GL_RGBA16F : GL_RGBA8, w, h, 0, GL_RGBA, type, 0);
-
- /* write into new single-sample buffer */
- glGenFramebuffers(1, &fbo_blit);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo_blit);
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex_blit, 0);
-
- GLenum status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE) {
- goto finally;
- }
-
- /* perform the copy */
- glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-
- /* read the results */
- glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_blit);
- glReadPixels(0, 0, w, h, GL_RGBA, type, pixels);
-
- /* restore the original frame-bufer */
- GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs);
- glBindFramebuffer(GL_FRAMEBUFFER, ofs_fb->object);
-
- finally:
- /* cleanup */
- glDeleteTextures(1, &tex_blit);
- glDeleteFramebuffers(1, &fbo_blit);
- }
- else {
- glReadPixels(0, 0, w, h, GL_RGBA, type, pixels);
- }
+ glReadPixels(0, 0, w, h, GL_RGBA, type, pixels);
}
int GPU_offscreen_width(const GPUOffScreen *ofs)