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:
authorAntony Riakiotakis <kalast@gmail.com>2014-11-18 14:12:28 +0300
committerAntony Riakiotakis <kalast@gmail.com>2014-11-18 14:15:16 +0300
commit0f947f2cc554bf3723a88631713bcd75cb745764 (patch)
treefc00e0529d4c40aee9be4386f18385e667b83e2d /source/blender/gpu/intern
parent998a867ba3b30911b1512ac782a23eadd6aa77db (diff)
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.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index ecab10364f6..ed1bbefa452 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;