summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-11-11 18:05:09 -0800
committerIan Romanick <[email protected]>2016-02-10 10:59:47 -0800
commit47a5aa4bfa06e891f88e759008ee4e7129387d7e (patch)
tree48af45f6d1686598b57e7745878cfa20e5e56a65 /src
parent03506c9ef1c533bafde01b793571799d3ab52bf5 (diff)
i965/meta: Don't pollute the renderbuffer namespace
tl;dr: For many types of GL object, we can *NEVER* use the Gen function. In OpenGL ES (all versions!) and OpenGL compatibility profile, applications don't have to call Gen functions. The GL spec is very clear about how you can mix-and-match generated names and non-generated names: you can use any name you want for a particular object type until you call the Gen function for that object type. Here's the problem scenario: - Application calls a meta function that generates a name. The first Gen will probably return 1. - Application decides to use the same name for an object of the same type without calling Gen. Many demo programs use names 1, 2, 3, etc. without calling Gen. - Application calls the meta function again, and the meta function replaces the data. The application's data is lost, and the app fails. Have fun debugging that. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363 Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_fast_clear.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_updownsample.c19
3 files changed, 11 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
index 38a505ae10d..b2b07e7e58e 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -36,6 +36,7 @@
#include "main/varray.h"
#include "main/uniforms.h"
#include "main/fbobject.h"
+#include "main/renderbuffer.h"
#include "main/texobj.h"
#include "main/api_validate.h"
@@ -881,7 +882,7 @@ brw_meta_resolve_color(struct brw_context *brw,
set_fast_clear_op(brw, 0);
use_rectlist(brw, false);
- _mesa_DeleteRenderbuffers(1, &rb->Name);
+ _mesa_reference_renderbuffer(&rb, NULL);
_mesa_DeleteFramebuffers(1, &fbo);
_mesa_meta_end(ctx);
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
index 16412ad3c04..5cfaec673c0 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -57,6 +57,7 @@
#include "main/blend.h"
#include "main/varray.h"
#include "main/shaderapi.h"
+#include "main/renderbuffer.h"
#include "util/ralloc.h"
#include "drivers/common/meta.h"
@@ -475,7 +476,7 @@ error:
_mesa_meta_fb_tex_blit_end(ctx, target, &blit);
_mesa_meta_end(ctx);
- _mesa_DeleteRenderbuffers(1, &rb->Name);
+ _mesa_reference_renderbuffer(&rb, NULL);
_mesa_DeleteFramebuffers(1, &fbo);
}
@@ -552,6 +553,6 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
brw_meta_stencil_blit(brw, dst, 0, 0, &dims);
brw_emit_mi_flush(brw);
- _mesa_DeleteRenderbuffers(1, &rb->Name);
+ _mesa_reference_renderbuffer(&rb, NULL);
_mesa_DeleteFramebuffers(1, &fbo);
}
diff --git a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
index 149f4bcc810..e90e6b1e326 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
@@ -29,6 +29,7 @@
#include "main/buffers.h"
#include "main/enums.h"
#include "main/fbobject.h"
+#include "main/renderbuffer.h"
#include "drivers/common/meta.h"
@@ -51,18 +52,10 @@ brw_get_rb_for_slice(struct brw_context *brw,
unsigned level, unsigned layer, bool flat)
{
struct gl_context *ctx = &brw->ctx;
- GLuint rbo;
- struct gl_renderbuffer *rb;
- struct intel_renderbuffer *irb;
-
- /* This turns the CreateRenderbuffers name into an actual struct
- * intel_renderbuffer.
- */
- _mesa_CreateRenderbuffers(1, &rbo);
-
- rb = _mesa_lookup_renderbuffer(ctx, rbo);
- irb = intel_renderbuffer(rb);
+ struct gl_renderbuffer *rb = ctx->Driver.NewRenderbuffer(ctx, 0xDEADBEEF);
+ struct intel_renderbuffer *irb = intel_renderbuffer(rb);
+ rb->RefCount = 1;
rb->Format = mt->format;
rb->_BaseFormat = _mesa_get_format_base_format(mt->format);
@@ -140,8 +133,8 @@ brw_meta_updownsample(struct brw_context *brw,
dst_mt->logical_width0, dst_mt->logical_height0,
blit_bit, GL_NEAREST);
- _mesa_DeleteRenderbuffers(1, &src_rb->Name);
- _mesa_DeleteRenderbuffers(1, &dst_rb->Name);
+ _mesa_reference_renderbuffer(&src_rb, NULL);
+ _mesa_reference_renderbuffer(&dst_rb, NULL);
_mesa_DeleteFramebuffers(2, fbos);
_mesa_meta_end(ctx);