From eb1a230d7cbfa0858ba96b7926d883c018ad806f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Jun 2018 09:44:44 +1000 Subject: [PATCH] vrend: add fb/texture bind interface that takes a separate resource id This is needed to implement texture views Reviewed-by: Gert Wollny --- src/vrend_renderer.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 0aa130c..0afae82 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1471,9 +1471,10 @@ int vrend_create_sampler_view(struct vrend_context *ctx, return 0; } -void vrend_fb_bind_texture(struct vrend_resource *res, - int idx, - uint32_t level, uint32_t layer) +static void vrend_fb_bind_texture_id(struct vrend_resource *res, + int id, + int idx, + uint32_t level, uint32_t layer) { const struct util_format_description *desc = util_format_description(res->base.format); GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + idx; @@ -1495,38 +1496,38 @@ void vrend_fb_bind_texture(struct vrend_resource *res, case GL_TEXTURE_CUBE_MAP_ARRAY: if (layer == 0xffffffff) glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment, - res->id, level); + id, level); else glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT, attachment, - res->id, level, layer); + id, level, layer); break; case GL_TEXTURE_3D: if (layer == 0xffffffff) glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment, - res->id, level); + id, level); else if (vrend_state.use_gles) glFramebufferTexture3DOES(GL_FRAMEBUFFER_EXT, attachment, - res->target, res->id, level, layer); + res->target, id, level, layer); else glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, attachment, - res->target, res->id, level, layer); + res->target, id, level, layer); break; case GL_TEXTURE_CUBE_MAP: if (layer == 0xffffffff) glFramebufferTexture(GL_FRAMEBUFFER_EXT, attachment, - res->id, level); + id, level); else glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, - GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, res->id, level); + GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, id, level); break; case GL_TEXTURE_1D: glFramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, attachment, - res->target, res->id, level); + res->target, id, level); break; case GL_TEXTURE_2D: default: glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, - res->target, res->id, level); + res->target, id, level); break; } @@ -1545,6 +1546,13 @@ void vrend_fb_bind_texture(struct vrend_resource *res, } } +void vrend_fb_bind_texture(struct vrend_resource *res, + int idx, + uint32_t level, uint32_t layer) +{ + vrend_fb_bind_texture_id(res, res->id, idx, level, layer); +} + static void vrend_hw_set_zsurf_texture(struct vrend_context *ctx) { struct vrend_resource *tex;