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

Erik Faye-Lund erik.faye-lund at collabora.com
Tue Jul 24 08:54:45 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 | 34 +++++++++++++++++-----------------
 src/vrend_renderer.h | 13 -------------
 2 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index c68bda0..794cfe0 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4968,21 +4968,21 @@ 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 == VREND_RES_BIND_SHADER_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 ||
+       args->bind == VIRGL_BIND_SHADER_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 ||
@@ -5192,29 +5192,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 || args->bind == VREND_RES_BIND_SHADER_BUFFER)) {
+   } else if (args->target == PIPE_BUFFER && (args->bind == 0 || args->bind == VIRGL_BIND_SHADER_BUFFER)) {
       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 bb76b44..43f991a 100644
--- a/src/vrend_renderer.h
+++ b/src/vrend_renderer.h
@@ -145,19 +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_SHADER_BUFFER (1 << 14)
-#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



More information about the virglrenderer-devel mailing list