[Mesa-dev] [PATCH] gallium: add PIPE_BIND_COMMAND_BUFFER

Christoph Bumiller e0425955 at student.tuwien.ac.at
Sat Feb 2 06:10:19 PST 2013


Intend to merge this into the previous ARB_draw_indirect patches.
Just in case there's any complaints ...

Needed to add this so the DRAW_INDIRECT_BUFFER doesn't get placed
into a non-GPU accessible domain. Besides, this seems reasonable,
and D3D11 has it, too (albeit a specialized version, called
D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS).
---
 src/gallium/docs/source/screen.rst           |    2 ++
 src/gallium/include/pipe/p_defines.h         |    1 +
 src/mesa/state_tracker/st_cb_bufferobjects.c |    3 +++
 3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index c94d87d..6bf0b3a 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -295,6 +295,8 @@ resources might be created and handled quite differently.
   bound to the graphics pipeline as a shader resource.
 * ``PIPE_BIND_COMPUTE_RESOURCE``: A buffer or texture that can be
   bound to the compute program as a shader resource.
+* ``PIPE_BIND_COMMAND_BUFFER``: A buffer or that may be sourced by the
+  GPU command processor, like with indirect drawing.
 
 .. _pipe_usage:
 
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 1aea9f4..4fb91cf 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -315,6 +315,7 @@ enum pipe_flush_flags {
 #define PIPE_BIND_GLOBAL               (1 << 18) /* set_global_binding */
 #define PIPE_BIND_SHADER_RESOURCE      (1 << 19) /* set_shader_resources */
 #define PIPE_BIND_COMPUTE_RESOURCE     (1 << 20) /* set_compute_resources */
+#define PIPE_BIND_COMMAND_BUFFER       (1 << 21) /* pipe_draw_info.indirect */
 
 /* The first two flags above were previously part of the amorphous
  * TEXTURE_USAGE, most of which are now descriptions of the ways a
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index d516735..265f758 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -205,6 +205,9 @@ st_bufferobj_data(struct gl_context *ctx,
    case GL_UNIFORM_BUFFER:
       bind = PIPE_BIND_CONSTANT_BUFFER;
       break;
+   case GL_DRAW_INDIRECT_BUFFER:
+      bind = PIPE_BIND_COMMAND_BUFFER;
+      break;
    default:
       bind = 0;
    }
-- 
1.7.3.4



More information about the mesa-dev mailing list