iris: Rework UBOs and SSBOs to use pipe_shader_buffer

This unifies a bunch of the UBO and SSBO code to use common structures.
Beyond iris_state_ref, pipe_shader_buffer also gives us a buffer size,
which can be useful when filling out the surface state.
This commit is contained in:
Kenneth Graunke
2019-04-16 23:44:15 -07:00
parent 00d4019676
commit 2f60850a3f
2 changed files with 71 additions and 104 deletions

View File

@@ -283,30 +283,20 @@ struct iris_compiled_shader {
uint8_t derived_data[0];
};
/**
* Constant buffer (UBO) information. See iris_set_const_buffer().
*/
struct iris_const_buffer {
/** The resource and offset for the actual constant data */
struct iris_state_ref data;
/** The resource and offset for the SURFACE_STATE for pull access. */
struct iris_state_ref surface_state;
};
/**
* API context state that is replicated per shader stage.
*/
struct iris_shader_state {
/** Uniform Buffers */
struct iris_const_buffer constbuf[PIPE_MAX_CONSTANT_BUFFERS];
struct pipe_shader_buffer constbuf[PIPE_MAX_CONSTANT_BUFFERS];
struct iris_state_ref constbuf_surf_state[PIPE_MAX_CONSTANT_BUFFERS];
struct pipe_constant_buffer cbuf0;
bool cbuf0_needs_upload;
/** Shader Storage Buffers */
struct pipe_resource *ssbo[PIPE_MAX_SHADER_BUFFERS];
struct iris_state_ref ssbo_surface_state[PIPE_MAX_SHADER_BUFFERS];
struct pipe_shader_buffer ssbo[PIPE_MAX_SHADER_BUFFERS];
struct iris_state_ref ssbo_surf_state[PIPE_MAX_SHADER_BUFFERS];
/** Shader Storage Images (image load store) */
struct {