[Mesa-dev] [PATCH 2/5] mesa: rename various buffer bindings to one struct.

Dave Airlie airlied at gmail.com
Fri Sep 15 03:57:11 UTC 2017


From: Dave Airlie <airlied at redhat.com>

One binding to bind them all, these are all the same thing.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |  6 ++---
 src/mesa/drivers/dri/i965/genX_state_upload.c    |  2 +-
 src/mesa/main/bufferobj.c                        | 18 ++++++-------
 src/mesa/main/mtypes.h                           | 33 +++---------------------
 src/mesa/state_tracker/st_atom_atomicbuf.c       |  2 +-
 src/mesa/state_tracker/st_atom_constbuf.c        |  2 +-
 src/mesa/state_tracker/st_atom_storagebuf.c      |  2 +-
 7 files changed, 20 insertions(+), 45 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index d110482..dae0439 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1279,7 +1279,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw, struct gl_program *prog,
       &stage_state->surf_offset[prog_data->binding_table.ubo_start];
 
    for (int i = 0; i < prog->info.num_ubos; i++) {
-      struct gl_uniform_buffer_binding *binding =
+      struct gl_buffer_binding *binding =
          &ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->Binding];
 
       if (binding->BufferObject == ctx->Shared->NullBufferObj) {
@@ -1304,7 +1304,7 @@ brw_upload_ubo_surfaces(struct brw_context *brw, struct gl_program *prog,
       &stage_state->surf_offset[prog_data->binding_table.ssbo_start];
 
    for (int i = 0; i < prog->info.num_ssbos; i++) {
-      struct gl_shader_storage_buffer_binding *binding =
+      struct gl_buffer_binding *binding =
          &ctx->ShaderStorageBufferBindings[prog->sh.ShaderStorageBlocks[i]->Binding];
 
       if (binding->BufferObject == ctx->Shared->NullBufferObj) {
@@ -1386,7 +1386,7 @@ brw_upload_abo_surfaces(struct brw_context *brw,
 
    if (prog->info.num_abos) {
       for (unsigned i = 0; i < prog->info.num_abos; i++) {
-         struct gl_atomic_buffer_binding *binding =
+         struct gl_buffer_binding *binding =
             &ctx->AtomicBufferBindings[prog->sh.AtomicBuffers[i]->Binding];
          struct intel_buffer_object *intel_bo =
             intel_buffer_object(binding->BufferObject);
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 6127616..54fada7 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -3076,7 +3076,7 @@ genX(upload_push_constant_packets)(struct brw_context *brw)
 
                const struct gl_uniform_block *block =
                   prog->sh.UniformBlocks[range->block];
-               const struct gl_uniform_buffer_binding *binding =
+               const struct gl_buffer_binding *binding =
                   &ctx->UniformBufferBindings[block->Binding];
 
                if (binding->BufferObject == ctx->Shared->NullBufferObj) {
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 93b66dc..7eb7ccf 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1265,7 +1265,7 @@ _mesa_BindBuffer(GLenum target, GLuint buffer)
  */
 static void
 set_atomic_buffer_binding(struct gl_context *ctx,
-                          struct gl_atomic_buffer_binding *binding,
+                          struct gl_buffer_binding *binding,
                           struct gl_buffer_object *bufObj,
                           GLintptr offset,
                           GLsizeiptr size,
@@ -1291,7 +1291,7 @@ set_atomic_buffer_binding(struct gl_context *ctx,
  */
 static void
 set_ubo_binding(struct gl_context *ctx,
-                struct gl_uniform_buffer_binding *binding,
+                struct gl_buffer_binding *binding,
                 struct gl_buffer_object *bufObj,
                 GLintptr offset,
                 GLsizeiptr size,
@@ -1318,7 +1318,7 @@ set_ubo_binding(struct gl_context *ctx,
  */
 static void
 set_ssbo_binding(struct gl_context *ctx,
-                 struct gl_shader_storage_buffer_binding *binding,
+                 struct gl_buffer_binding *binding,
                  struct gl_buffer_object *bufObj,
                  GLintptr offset,
                  GLsizeiptr size,
@@ -1352,7 +1352,7 @@ bind_uniform_buffer(struct gl_context *ctx,
                     GLsizeiptr size,
                     GLboolean autoSize)
 {
-   struct gl_uniform_buffer_binding *binding =
+   struct gl_buffer_binding *binding =
       &ctx->UniformBufferBindings[index];
 
    if (binding->BufferObject == bufObj &&
@@ -1383,7 +1383,7 @@ bind_shader_storage_buffer(struct gl_context *ctx,
                            GLsizeiptr size,
                            GLboolean autoSize)
 {
-   struct gl_shader_storage_buffer_binding *binding =
+   struct gl_buffer_binding *binding =
       &ctx->ShaderStorageBufferBindings[index];
 
    if (binding->BufferObject == bufObj &&
@@ -1411,7 +1411,7 @@ bind_atomic_buffer(struct gl_context *ctx, unsigned index,
                    struct gl_buffer_object *bufObj, GLintptr offset,
                    GLsizeiptr size, GLboolean autoSize)
 {
-   struct gl_atomic_buffer_binding *binding =
+   struct gl_buffer_binding *binding =
       &ctx->AtomicBufferBindings[index];
    if (binding->BufferObject == bufObj &&
        binding->Offset == offset &&
@@ -3804,7 +3804,7 @@ bind_uniform_buffers(struct gl_context *ctx, GLuint first, GLsizei count,
    _mesa_HashLockMutex(ctx->Shared->BufferObjects);
 
    for (int i = 0; i < count; i++) {
-      struct gl_uniform_buffer_binding *binding =
+      struct gl_buffer_binding *binding =
          &ctx->UniformBufferBindings[first + i];
       struct gl_buffer_object *bufObj;
       GLintptr offset = 0;
@@ -3914,7 +3914,7 @@ bind_shader_storage_buffers(struct gl_context *ctx, GLuint first,
    _mesa_HashLockMutex(ctx->Shared->BufferObjects);
 
    for (int i = 0; i < count; i++) {
-      struct gl_shader_storage_buffer_binding *binding =
+      struct gl_buffer_binding *binding =
          &ctx->ShaderStorageBufferBindings[first + i];
       struct gl_buffer_object *bufObj;
       GLintptr offset = 0;
@@ -4248,7 +4248,7 @@ bind_atomic_buffers(struct gl_context *ctx,
    _mesa_HashLockMutex(ctx->Shared->BufferObjects);
 
    for (int i = 0; i < count; i++) {
-      struct gl_atomic_buffer_binding *binding =
+      struct gl_buffer_binding *binding =
          &ctx->AtomicBufferBindings[first + i];
       struct gl_buffer_object *bufObj;
       GLintptr offset = 0;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9c2c7d4..8192656 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4545,7 +4545,7 @@ struct gl_driver_flags
    uint64_t NewShaderConstants[MESA_SHADER_STAGES];
 };
 
-struct gl_uniform_buffer_binding
+struct gl_buffer_binding
 {
    struct gl_buffer_object *BufferObject;
    /** Start of uniform block data in the buffer */
@@ -4559,20 +4559,6 @@ struct gl_uniform_buffer_binding
    GLboolean AutomaticSize;
 };
 
-struct gl_shader_storage_buffer_binding
-{
-   struct gl_buffer_object *BufferObject;
-   /** Start of shader storage block data in the buffer */
-   GLintptr Offset;
-   /** Size of data allowed to be referenced from the buffer (in bytes) */
-   GLsizeiptr Size;
-   /**
-    * glBindBufferBase() indicates that the Size should be ignored and only
-    * limited by the current size of the BufferObject.
-    */
-   GLboolean AutomaticSize;
-};
-
 /**
  * ARB_shader_image_load_store image unit.
  */
@@ -4628,17 +4614,6 @@ struct gl_image_unit
 };
 
 /**
- * Binding point for an atomic counter buffer object.
- */
-struct gl_atomic_buffer_binding
-{
-   struct gl_buffer_object *BufferObject;
-   GLintptr Offset;
-   GLsizeiptr Size;
-   GLboolean AutomaticSize;
-};
-
-/**
  * Shader subroutines storage
  */
 struct gl_subroutine_index_binding
@@ -4888,7 +4863,7 @@ struct gl_context
     * associated with uniform blocks by glUniformBlockBinding()'s state in the
     * shader program.
     */
-   struct gl_uniform_buffer_binding
+   struct gl_buffer_binding
       UniformBufferBindings[MAX_COMBINED_UNIFORM_BUFFERS];
 
    /**
@@ -4897,7 +4872,7 @@ struct gl_context
     * glBindBufferBase().  They are associated with shader storage blocks by
     * glShaderStorageBlockBinding()'s state in the shader program.
     */
-   struct gl_shader_storage_buffer_binding
+   struct gl_buffer_binding
       ShaderStorageBufferBindings[MAX_COMBINED_SHADER_STORAGE_BUFFERS];
 
    /**
@@ -4915,7 +4890,7 @@ struct gl_context
    /**
     * Array of atomic counter buffer binding points.
     */
-   struct gl_atomic_buffer_binding
+   struct gl_buffer_binding
       AtomicBufferBindings[MAX_COMBINED_ATOMIC_BUFFERS];
 
    /**
diff --git a/src/mesa/state_tracker/st_atom_atomicbuf.c b/src/mesa/state_tracker/st_atom_atomicbuf.c
index 171fecc..7ebcd08 100644
--- a/src/mesa/state_tracker/st_atom_atomicbuf.c
+++ b/src/mesa/state_tracker/st_atom_atomicbuf.c
@@ -52,7 +52,7 @@ st_bind_atomics(struct st_context *st, struct gl_program *prog,
    for (i = 0; i < prog->sh.data->NumAtomicBuffers; i++) {
       struct gl_active_atomic_buffer *atomic =
          &prog->sh.data->AtomicBuffers[i];
-      struct gl_atomic_buffer_binding *binding =
+      struct gl_buffer_binding *binding =
          &st->ctx->AtomicBufferBindings[atomic->Binding];
       struct st_buffer_object *st_obj =
          st_buffer_object(binding->BufferObject);
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index 8c6d61a..497d33f 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -208,7 +208,7 @@ static void st_bind_ubos(struct st_context *st, struct gl_program *prog,
       return;
 
    for (i = 0; i < prog->info.num_ubos; i++) {
-      struct gl_uniform_buffer_binding *binding;
+      struct gl_buffer_binding *binding;
       struct st_buffer_object *st_obj;
 
       binding =
diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c
index 43dd300..a31a8fd 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -54,7 +54,7 @@ st_bind_ssbos(struct st_context *st, struct gl_program *prog,
    c = &st->ctx->Const.Program[prog->info.stage];
 
    for (i = 0; i < prog->info.num_ssbos; i++) {
-      struct gl_shader_storage_buffer_binding *binding;
+      struct gl_buffer_binding *binding;
       struct st_buffer_object *st_obj;
       struct pipe_shader_buffer *sb = &buffers[i];
 
-- 
2.9.5



More information about the mesa-dev mailing list