mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 08:50:24 +01:00
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>
This commit is contained in:
parent
03506c9ef1
commit
47a5aa4bfa
3 changed files with 11 additions and 16 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue