mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
meta: Convert _mesa_meta_bind_fbo_image to take a gl_framebuffer instead of a GL API handle
Also change the name of the function to _mesa_meta_framebuffer_texture_image. The function is basically a wrapper around _mesa_framebuffer_texture (which is used to implement glFramebufferTexture1D and friends), so it makes sense for it's name to be similar to that. The next patch will clean _mesa_meta_framebuffer_texture_image up considerably. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
parent
ac222626ad
commit
f69c743069
5 changed files with 61 additions and 49 deletions
|
|
@ -104,8 +104,11 @@ static void meta_drawpix_cleanup(struct gl_context *ctx,
|
|||
struct drawpix_state *drawpix);
|
||||
|
||||
void
|
||||
_mesa_meta_bind_fbo_image(GLenum fboTarget, GLenum attachment,
|
||||
struct gl_texture_image *texImage, GLuint layer)
|
||||
_mesa_meta_framebuffer_texture_image(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
GLenum attachment,
|
||||
struct gl_texture_image *texImage,
|
||||
GLuint layer)
|
||||
{
|
||||
struct gl_texture_object *texObj = texImage->TexObject;
|
||||
int level = texImage->Level;
|
||||
|
|
@ -113,32 +116,23 @@ _mesa_meta_bind_fbo_image(GLenum fboTarget, GLenum attachment,
|
|||
|
||||
switch (texTarget) {
|
||||
case GL_TEXTURE_1D:
|
||||
_mesa_FramebufferTexture1D(fboTarget,
|
||||
attachment,
|
||||
texTarget,
|
||||
texObj->Name,
|
||||
level);
|
||||
_mesa_framebuffer_texture(ctx, fb, attachment, texObj, texTarget,
|
||||
level, layer, false, __func__);
|
||||
break;
|
||||
case GL_TEXTURE_1D_ARRAY:
|
||||
case GL_TEXTURE_2D_ARRAY:
|
||||
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
|
||||
case GL_TEXTURE_CUBE_MAP_ARRAY:
|
||||
case GL_TEXTURE_3D:
|
||||
_mesa_FramebufferTextureLayer(fboTarget,
|
||||
attachment,
|
||||
texObj->Name,
|
||||
level,
|
||||
layer);
|
||||
_mesa_framebuffer_texture(ctx, fb, attachment, texObj, texTarget,
|
||||
level, layer, false, __func__);
|
||||
break;
|
||||
default: /* 2D / cube */
|
||||
if (texTarget == GL_TEXTURE_CUBE_MAP)
|
||||
texTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
|
||||
|
||||
_mesa_FramebufferTexture2D(fboTarget,
|
||||
attachment,
|
||||
texTarget,
|
||||
texObj->Name,
|
||||
level);
|
||||
_mesa_framebuffer_texture(ctx, fb, attachment, texObj, texTarget,
|
||||
level, layer, false, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2822,20 +2816,23 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims,
|
|||
|
||||
if (rb->_BaseFormat == GL_DEPTH_STENCIL ||
|
||||
rb->_BaseFormat == GL_DEPTH_COMPONENT) {
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_DEPTH_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
mask = GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
if (rb->_BaseFormat == GL_DEPTH_STENCIL &&
|
||||
texImage->_BaseFormat == GL_DEPTH_STENCIL) {
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_STENCIL_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
mask |= GL_STENCIL_BUFFER_BIT;
|
||||
}
|
||||
_mesa_DrawBuffer(GL_NONE);
|
||||
} else {
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
texImage, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
texImage, zoffset);
|
||||
mask = GL_COLOR_BUFFER_BIT;
|
||||
_mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
}
|
||||
|
|
@ -3434,8 +3431,9 @@ cleartexsubimage_color(struct gl_context *ctx,
|
|||
GLenum datatype;
|
||||
GLenum status;
|
||||
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
texImage, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
texImage, zoffset);
|
||||
|
||||
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
|
|
@ -3481,12 +3479,14 @@ cleartexsubimage_depth_stencil(struct gl_context *ctx,
|
|||
GLfloat depthValue;
|
||||
GLenum status;
|
||||
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_DEPTH_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
|
||||
if (texImage->_BaseFormat == GL_DEPTH_STENCIL)
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_STENCIL_ATTACHMENT,
|
||||
texImage, zoffset);
|
||||
|
||||
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
|
|
|
|||
|
|
@ -661,7 +661,10 @@ _mesa_meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
|
|||
struct gen_mipmap_state *mipmap);
|
||||
|
||||
void
|
||||
_mesa_meta_bind_fbo_image(GLenum target, GLenum attachment,
|
||||
struct gl_texture_image *texImage, GLuint layer);
|
||||
_mesa_meta_framebuffer_texture_image(struct gl_context *ctx,
|
||||
struct gl_framebuffer *fb,
|
||||
GLenum attachment,
|
||||
struct gl_texture_image *texImage,
|
||||
GLuint layer);
|
||||
|
||||
#endif /* META_H */
|
||||
|
|
|
|||
|
|
@ -238,8 +238,8 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
|
|||
/* Prefer the tex image because, even if we have a renderbuffer, we may
|
||||
* have had to wrap it in a texture view.
|
||||
*/
|
||||
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, attachment,
|
||||
src_view_tex_image, src_z);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer, attachment,
|
||||
src_view_tex_image, src_z);
|
||||
} else {
|
||||
_mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment,
|
||||
src_renderbuffer);
|
||||
|
|
@ -253,8 +253,8 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
|
|||
_mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment,
|
||||
dst_renderbuffer);
|
||||
} else {
|
||||
_mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, attachment,
|
||||
dst_tex_image, dst_z);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer, attachment,
|
||||
dst_tex_image, dst_z);
|
||||
}
|
||||
|
||||
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ fallback_required(struct gl_context *ctx, GLenum target,
|
|||
_mesa_GenFramebuffers(1, &mipmap->FBO);
|
||||
_mesa_BindFramebuffer(fbo_target, mipmap->FBO);
|
||||
|
||||
_mesa_meta_bind_fbo_image(fbo_target, GL_COLOR_ATTACHMENT0, baseImage, 0);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0, baseImage, 0);
|
||||
|
||||
status = _mesa_CheckFramebufferStatus(fbo_target);
|
||||
|
||||
|
|
@ -354,7 +355,9 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
|
|||
_mesa_buffer_data(ctx, mipmap->buf_obj, GL_NONE, sizeof(verts), verts,
|
||||
GL_DYNAMIC_DRAW, __func__);
|
||||
|
||||
_mesa_meta_bind_fbo_image(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, dstImage, layer);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0, dstImage,
|
||||
layer);
|
||||
|
||||
/* sanity check */
|
||||
if (_mesa_CheckFramebufferStatus(GL_FRAMEBUFFER) !=
|
||||
|
|
|
|||
|
|
@ -239,15 +239,17 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
|
|||
yoffset = 0;
|
||||
}
|
||||
|
||||
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
pbo_tex_image, 0);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
pbo_tex_image, 0);
|
||||
/* If this passes on the first layer it should pass on the others */
|
||||
status = _mesa_CheckFramebufferStatus(GL_READ_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
goto fail;
|
||||
|
||||
_mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset);
|
||||
/* If this passes on the first layer it should pass on the others */
|
||||
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
|
|
@ -263,8 +265,9 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
|
|||
goto fail;
|
||||
|
||||
for (z = 1; z < depth; z++) {
|
||||
_mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset + z);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset + z);
|
||||
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
|
|
@ -378,8 +381,9 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
|
|||
*/
|
||||
if (tex_image) {
|
||||
_mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);
|
||||
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset);
|
||||
/* If this passes on the first layer it should pass on the others */
|
||||
status = _mesa_CheckFramebufferStatus(GL_READ_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
|
|
@ -389,8 +393,9 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
|
|||
}
|
||||
|
||||
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
|
||||
_mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
pbo_tex_image, 0);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
pbo_tex_image, 0);
|
||||
/* If this passes on the first layer it should pass on the others */
|
||||
status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE)
|
||||
|
|
@ -427,8 +432,9 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
|
|||
}
|
||||
|
||||
for (z = 1; z < depth; z++) {
|
||||
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset + z);
|
||||
_mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
tex_image, zoffset + z);
|
||||
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue