[Bf-blender-cvs] [0f947f2] master: GPU framebuffer/texture API: Warn when binding a texture that is also attached to a framebuffer or vice versa.
Antony Riakiotakis
noreply at git.blender.org
Tue Nov 18 12:15:49 CET 2014
Commit: 0f947f2cc554bf3723a88631713bcd75cb745764
Author: Antony Riakiotakis
Date: Tue Nov 18 12:12:28 2014 +0100
Branches: master
https://developer.blender.org/rB0f947f2cc554bf3723a88631713bcd75cb745764
GPU framebuffer/texture API: Warn when binding a texture that is also
attached to a framebuffer or vice versa.
might be more correct to just handle the case and unbind here.
===================================================================
M source/blender/gpu/intern/gpu_extensions.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index ecab103..ed1bbef 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -103,6 +103,16 @@ static struct GPUGlobal {
GPUTexture *invalid_tex_3D;
} GG = {1, 0};
+/* Number of maximum output slots. We support 4 outputs for now (usually we wouldn't need more to preserve fill rate) */
+#define GPU_FB_MAX_SLOTS 4
+
+struct GPUFrameBuffer {
+ GLuint object;
+ GPUTexture *colortex[GPU_FB_MAX_SLOTS];
+ GPUTexture *depthtex;
+};
+
+
/* GPU Types */
int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
@@ -739,7 +749,13 @@ void GPU_texture_bind(GPUTexture *tex, int number)
return;
}
- if (number == -1)
+ if (tex->fb) {
+ if (tex->fb->object == GG.currentfb) {
+ fprintf(stderr, "Feedback loop warning!: Attempting to bind texture attached to current framebuffer!\n");
+ }
+ }
+
+ if (number < 0)
return;
GPU_print_error("Pre Texture Bind");
@@ -833,15 +849,6 @@ GPUFrameBuffer *GPU_texture_framebuffer(GPUTexture *tex)
/* GPUFrameBuffer */
-/* Number of maximum output slots. We support 4 outputs for now (usually we wouldn't need more to preserve fill rate) */
-#define GPU_FB_MAX_SLOTS 4
-
-struct GPUFrameBuffer {
- GLuint object;
- GPUTexture *colortex[GPU_FB_MAX_SLOTS];
- GPUTexture *depthtex;
-};
-
GPUFrameBuffer *GPU_framebuffer_create(void)
{
GPUFrameBuffer *fb;
@@ -873,6 +880,10 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slot
return 0;
}
+ if (tex->target != -1) {
+ fprintf(stderr, "Feedback loop warning!: Attempting to attach texture to framebuffer while still bound to texture unit for drawing!");
+ }
+
if (tex->depth)
attachment = GL_DEPTH_ATTACHMENT_EXT;
else
@@ -929,7 +940,7 @@ void GPU_framebuffer_texture_detach(GPUTexture *tex)
GLenum attachment;
GPUFrameBuffer *fb;
- if (!tex->fb || tex->fb_attachment == -1)
+ if (!tex->fb)
return;
fb = tex->fb;
More information about the Bf-blender-cvs
mailing list