[virglrenderer-devel] [PATCH 1/6] vrend: add fb/texture bind interface that takes a separate resource id

Dave Airlie airlied at gmail.com
Fri Jun 8 01:18:50 UTC 2018


From: Dave Airlie <airlied at redhat.com>

This is needed to implement texture views
---
 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 5ef3555..02cf683 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -1421,9 +1421,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;
@@ -1446,38 +1447,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;
    }
 
@@ -1496,6 +1497,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;
-- 
2.14.3



More information about the virglrenderer-devel mailing list