summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2015-11-11 18:05:09 -0800
committerIan Romanick <ian.d.romanick@intel.com>2016-02-10 10:59:47 -0800
commit47a5aa4bfa06e891f88e759008ee4e7129387d7e (patch)
tree48af45f6d1686598b57e7745878cfa20e5e56a65 /src/mesa/drivers/dri/i965/brw_meta_updownsample.c
parent03506c9ef1c533bafde01b793571799d3ab52bf5 (diff)
downloadexternal_mesa3d-47a5aa4bfa06e891f88e759008ee4e7129387d7e.zip
external_mesa3d-47a5aa4bfa06e891f88e759008ee4e7129387d7e.tar.gz
external_mesa3d-47a5aa4bfa06e891f88e759008ee4e7129387d7e.tar.bz2
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 <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363 Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_meta_updownsample.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_updownsample.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
index 149f4bc..e90e6b1 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);