i965/meta: Return struct gl_renderbuffer* from brw_get_rb_for_slice instead of GL API handle
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
@@ -1368,9 +1368,10 @@ GLboolean brwCreateContext(gl_api api,
|
||||
/*======================================================================
|
||||
* brw_misc_state.c
|
||||
*/
|
||||
GLuint brw_get_rb_for_slice(struct brw_context *brw,
|
||||
struct intel_mipmap_tree *mt,
|
||||
unsigned level, unsigned layer, bool flat);
|
||||
struct gl_renderbuffer *brw_get_rb_for_slice(struct brw_context *brw,
|
||||
struct intel_mipmap_tree *mt,
|
||||
unsigned level, unsigned layer,
|
||||
bool flat);
|
||||
|
||||
void brw_meta_updownsample(struct brw_context *brw,
|
||||
struct intel_mipmap_tree *src,
|
||||
|
||||
@@ -845,7 +845,8 @@ brw_meta_resolve_color(struct brw_context *brw,
|
||||
struct intel_mipmap_tree *mt)
|
||||
{
|
||||
struct gl_context *ctx = &brw->ctx;
|
||||
GLuint fbo, rbo;
|
||||
GLuint fbo;
|
||||
struct gl_renderbuffer *rb;
|
||||
struct rect rect;
|
||||
|
||||
brw_emit_mi_flush(brw);
|
||||
@@ -853,12 +854,12 @@ brw_meta_resolve_color(struct brw_context *brw,
|
||||
_mesa_meta_begin(ctx, MESA_META_ALL);
|
||||
|
||||
_mesa_GenFramebuffers(1, &fbo);
|
||||
rbo = brw_get_rb_for_slice(brw, mt, 0, 0, false);
|
||||
rb = brw_get_rb_for_slice(brw, mt, 0, 0, false);
|
||||
|
||||
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
|
||||
_mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, rbo);
|
||||
GL_RENDERBUFFER, rb->Name);
|
||||
_mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
|
||||
brw_fast_clear_init(brw);
|
||||
@@ -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, &rbo);
|
||||
_mesa_DeleteRenderbuffers(1, &rb->Name);
|
||||
_mesa_DeleteFramebuffers(1, &fbo);
|
||||
|
||||
_mesa_meta_end(ctx);
|
||||
|
||||
@@ -423,7 +423,8 @@ brw_meta_stencil_blit(struct brw_context *brw,
|
||||
struct gl_context *ctx = &brw->ctx;
|
||||
struct blit_dims dims = *orig_dims;
|
||||
struct fb_tex_blit_state blit;
|
||||
GLuint prog, fbo, rbo;
|
||||
GLuint prog, fbo;
|
||||
struct gl_renderbuffer *rb;
|
||||
GLenum target;
|
||||
|
||||
_mesa_meta_fb_tex_blit_begin(ctx, &blit);
|
||||
@@ -436,13 +437,13 @@ brw_meta_stencil_blit(struct brw_context *brw,
|
||||
|
||||
_mesa_GenFramebuffers(1, &fbo);
|
||||
/* Force the surface to be configured for level zero. */
|
||||
rbo = brw_get_rb_for_slice(brw, dst_mt, 0, dst_layer, true);
|
||||
rb = brw_get_rb_for_slice(brw, dst_mt, 0, dst_layer, true);
|
||||
adjust_msaa(&dims, dst_mt->num_samples);
|
||||
adjust_tiling(&dims, dst_mt->num_samples);
|
||||
|
||||
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
|
||||
_mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_RENDERBUFFER, rbo);
|
||||
GL_RENDERBUFFER, rb->Name);
|
||||
_mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
ctx->DrawBuffer->_Status = GL_FRAMEBUFFER_COMPLETE;
|
||||
|
||||
@@ -474,7 +475,7 @@ error:
|
||||
_mesa_meta_fb_tex_blit_end(ctx, target, &blit);
|
||||
_mesa_meta_end(ctx);
|
||||
|
||||
_mesa_DeleteRenderbuffers(1, &rbo);
|
||||
_mesa_DeleteRenderbuffers(1, &rb->Name);
|
||||
_mesa_DeleteFramebuffers(1, &fbo);
|
||||
}
|
||||
|
||||
@@ -532,7 +533,8 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
|
||||
.dst_x0 = 0, .dst_y0 = 0,
|
||||
.dst_x1 = dst->logical_width0, .dst_y1 = dst->logical_height0,
|
||||
.mirror_x = 0, .mirror_y = 0 };
|
||||
GLuint fbo, rbo;
|
||||
GLuint fbo;
|
||||
struct gl_renderbuffer *rb;
|
||||
|
||||
if (dst->stencil_mt)
|
||||
dst = dst->stencil_mt;
|
||||
@@ -541,15 +543,15 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
|
||||
_mesa_meta_begin(ctx, MESA_META_ALL);
|
||||
|
||||
_mesa_GenFramebuffers(1, &fbo);
|
||||
rbo = brw_get_rb_for_slice(brw, src, 0, 0, false);
|
||||
rb = brw_get_rb_for_slice(brw, src, 0, 0, false);
|
||||
|
||||
_mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
|
||||
_mesa_FramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER, rbo);
|
||||
GL_RENDERBUFFER, rb->Name);
|
||||
|
||||
brw_meta_stencil_blit(brw, dst, 0, 0, &dims);
|
||||
brw_emit_mi_flush(brw);
|
||||
|
||||
_mesa_DeleteRenderbuffers(1, &rbo);
|
||||
_mesa_DeleteRenderbuffers(1, &rb->Name);
|
||||
_mesa_DeleteFramebuffers(1, &fbo);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* Clobbers the current renderbuffer binding (ctx->CurrentRenderbuffer).
|
||||
*/
|
||||
GLuint
|
||||
struct gl_renderbuffer *
|
||||
brw_get_rb_for_slice(struct brw_context *brw,
|
||||
struct intel_mipmap_tree *mt,
|
||||
unsigned level, unsigned layer, bool flat)
|
||||
@@ -88,7 +88,7 @@ brw_get_rb_for_slice(struct brw_context *brw,
|
||||
|
||||
intel_miptree_reference(&irb->mt, mt);
|
||||
|
||||
return rbo;
|
||||
return rb;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,9 @@ brw_meta_updownsample(struct brw_context *brw,
|
||||
struct intel_mipmap_tree *dst_mt)
|
||||
{
|
||||
struct gl_context *ctx = &brw->ctx;
|
||||
GLuint fbos[2], src_rbo, dst_rbo, src_fbo, dst_fbo;
|
||||
GLuint fbos[2], src_fbo, dst_fbo;
|
||||
struct gl_renderbuffer *src_rb;
|
||||
struct gl_renderbuffer *dst_rb;
|
||||
GLenum drawbuffer;
|
||||
GLbitfield attachment, blit_bit;
|
||||
|
||||
@@ -119,19 +121,19 @@ brw_meta_updownsample(struct brw_context *brw,
|
||||
|
||||
_mesa_meta_begin(ctx, MESA_META_ALL);
|
||||
_mesa_GenFramebuffers(2, fbos);
|
||||
src_rbo = brw_get_rb_for_slice(brw, src_mt, 0, 0, false);
|
||||
dst_rbo = brw_get_rb_for_slice(brw, dst_mt, 0, 0, false);
|
||||
src_rb = brw_get_rb_for_slice(brw, src_mt, 0, 0, false);
|
||||
dst_rb = brw_get_rb_for_slice(brw, dst_mt, 0, 0, false);
|
||||
src_fbo = fbos[0];
|
||||
dst_fbo = fbos[1];
|
||||
|
||||
_mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo);
|
||||
_mesa_FramebufferRenderbuffer(GL_READ_FRAMEBUFFER, attachment,
|
||||
GL_RENDERBUFFER, src_rbo);
|
||||
GL_RENDERBUFFER, src_rb->Name);
|
||||
_mesa_ReadBuffer(drawbuffer);
|
||||
|
||||
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo);
|
||||
_mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, attachment,
|
||||
GL_RENDERBUFFER, dst_rbo);
|
||||
GL_RENDERBUFFER, dst_rb->Name);
|
||||
_mesa_DrawBuffer(drawbuffer);
|
||||
|
||||
_mesa_BlitFramebuffer(0, 0,
|
||||
@@ -140,8 +142,8 @@ brw_meta_updownsample(struct brw_context *brw,
|
||||
dst_mt->logical_width0, dst_mt->logical_height0,
|
||||
blit_bit, GL_NEAREST);
|
||||
|
||||
_mesa_DeleteRenderbuffers(1, &src_rbo);
|
||||
_mesa_DeleteRenderbuffers(1, &dst_rbo);
|
||||
_mesa_DeleteRenderbuffers(1, &src_rb->Name);
|
||||
_mesa_DeleteRenderbuffers(1, &dst_rb->Name);
|
||||
_mesa_DeleteFramebuffers(2, fbos);
|
||||
|
||||
_mesa_meta_end(ctx);
|
||||
|
||||
Reference in New Issue
Block a user