[virglrenderer-devel] [PATCH 2/4] get rid of diplicate definition of VREND_RES_BIND-flags

Erik Faye-Lund erik.faye-lund at collabora.com
Mon Jul 16 15:43:42 UTC 2018


These are identical to the corresponding VIRGL_BIND-flags,
so let's get rid of this duplicate definition.

Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
---
 src/vrend_renderer.c | 30 +++++++++++++++---------------
 src/vrend_renderer.h | 12 ------------
 2 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 8aec994..3eab13f 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4839,20 +4839,20 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
    }
 
    if (args->bind == 0 ||
-       args->bind == VREND_RES_BIND_CUSTOM ||
-       args->bind == VREND_RES_BIND_INDEX_BUFFER ||
-       args->bind == VREND_RES_BIND_STREAM_OUTPUT ||
-       args->bind == VREND_RES_BIND_VERTEX_BUFFER ||
-       args->bind == VREND_RES_BIND_CONSTANT_BUFFER) {
+       args->bind == VIRGL_BIND_CUSTOM ||
+       args->bind == VIRGL_BIND_INDEX_BUFFER ||
+       args->bind == VIRGL_BIND_STREAM_OUTPUT ||
+       args->bind == VIRGL_BIND_VERTEX_BUFFER ||
+       args->bind == VIRGL_BIND_CONSTANT_BUFFER) {
       if (args->target != PIPE_BUFFER)
          return -1;
       if (args->height != 1 || args->depth != 1)
          return -1;
    } else {
-      if (!((args->bind & VREND_RES_BIND_SAMPLER_VIEW) ||
-            (args->bind & VREND_RES_BIND_DEPTH_STENCIL) ||
-            (args->bind & VREND_RES_BIND_RENDER_TARGET) ||
-            (args->bind & VREND_RES_BIND_CURSOR)))
+      if (!((args->bind & VIRGL_BIND_SAMPLER_VIEW) ||
+            (args->bind & VIRGL_BIND_DEPTH_STENCIL) ||
+            (args->bind & VIRGL_BIND_RENDER_TARGET) ||
+            (args->bind & VIRGL_BIND_CURSOR)))
          return -1;
 
       if (args->target == PIPE_TEXTURE_2D ||
@@ -5062,29 +5062,29 @@ int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *a
 
    pipe_reference_init(&gr->base.reference, 1);
 
-   if (args->bind == VREND_RES_BIND_CUSTOM) {
+   if (args->bind == VIRGL_BIND_CUSTOM) {
       /* custom should only be for buffers */
       gr->ptr = malloc(args->width);
       if (!gr->ptr) {
          FREE(gr);
          return ENOMEM;
       }
-   } else if (args->bind == VREND_RES_BIND_INDEX_BUFFER) {
+   } else if (args->bind == VIRGL_BIND_INDEX_BUFFER) {
       gr->target = GL_ELEMENT_ARRAY_BUFFER_ARB;
       vrend_create_buffer(gr, args->width);
-   } else if (args->bind == VREND_RES_BIND_STREAM_OUTPUT) {
+   } else if (args->bind == VIRGL_BIND_STREAM_OUTPUT) {
       gr->target = GL_TRANSFORM_FEEDBACK_BUFFER;
       vrend_create_buffer(gr, args->width);
-   } else if (args->bind == VREND_RES_BIND_VERTEX_BUFFER) {
+   } else if (args->bind == VIRGL_BIND_VERTEX_BUFFER) {
       gr->target = GL_ARRAY_BUFFER_ARB;
       vrend_create_buffer(gr, args->width);
-   } else if (args->bind == VREND_RES_BIND_CONSTANT_BUFFER) {
+   } else if (args->bind == VIRGL_BIND_CONSTANT_BUFFER) {
       gr->target = GL_UNIFORM_BUFFER;
       vrend_create_buffer(gr, args->width);
    } else if (args->target == PIPE_BUFFER && args->bind == 0) {
       gr->target = GL_ARRAY_BUFFER_ARB;
       vrend_create_buffer(gr, args->width);
-   } else if (args->target == PIPE_BUFFER && (args->bind & VREND_RES_BIND_SAMPLER_VIEW)) {
+   } else if (args->target == PIPE_BUFFER && (args->bind & VIRGL_BIND_SAMPLER_VIEW)) {
       /*
        * On Desktop we use GL_ARB_texture_buffer_object on GLES we use
        * GL_EXT_texture_buffer (it is in the ANDRIOD extension pack).
diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h
index b2c2fd8..84933a0 100644
--- a/src/vrend_renderer.h
+++ b/src/vrend_renderer.h
@@ -145,18 +145,6 @@ int vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *na
 void vrend_renderer_context_create_internal(uint32_t handle, uint32_t nlen, const char *name);
 void vrend_renderer_context_destroy(uint32_t handle);
 
-/* virgl bind flags - these are compatible with mesa 10.5 gallium.
-   but are fixed, no other should be passed to virgl either. */
-#define VREND_RES_BIND_DEPTH_STENCIL (1 << 0)
-#define VREND_RES_BIND_RENDER_TARGET (1 << 1)
-#define VREND_RES_BIND_SAMPLER_VIEW  (1 << 3)
-#define VREND_RES_BIND_VERTEX_BUFFER (1 << 4)
-#define VREND_RES_BIND_INDEX_BUFFER  (1 << 5)
-#define VREND_RES_BIND_CONSTANT_BUFFER (1 << 6)
-#define VREND_RES_BIND_STREAM_OUTPUT (1 << 11)
-#define VREND_RES_BIND_CURSOR        (1 << 16)
-#define VREND_RES_BIND_CUSTOM        (1 << 17)
-
 struct vrend_renderer_resource_create_args {
    uint32_t handle;
    enum pipe_texture_target target;
-- 
2.18.0.rc2



More information about the virglrenderer-devel mailing list