diff options
author | Jason Ekstrand <[email protected]> | 2015-08-26 15:01:38 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-08-26 17:59:15 -0700 |
commit | 5446bf352e130ed4c61c33bddf2de7cf7899a5d7 (patch) | |
tree | f6be018ad9dc8c103ea666fa71d6ab0fba12c97f /src/vulkan/anv_cmd_buffer.c | |
parent | 36134e105082ea6c08f90529f8544fae35654d19 (diff) |
vk: Add initial API support for setting push constants
This doesn't add support for actually uploading them, it just ensures that
we have and update the shadow copy.
Diffstat (limited to 'src/vulkan/anv_cmd_buffer.c')
-rw-r--r-- | src/vulkan/anv_cmd_buffer.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 033c7872aaf..a2a2833b62e 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -47,10 +47,12 @@ anv_cmd_state_init(struct anv_cmd_state *state) state->ds_state = NULL; memset(&state->state_vf, 0, sizeof(state->state_vf)); memset(&state->descriptors, 0, sizeof(state->descriptors)); + memset(&state->push_constants, 0, sizeof(state->push_constants)); state->dirty = 0; state->vb_dirty = 0; state->descriptors_dirty = 0; + state->push_constants_dirty = 0; state->pipeline = NULL; state->vp_state = NULL; state->rs_state = NULL; @@ -210,12 +212,14 @@ void anv_CmdBindPipeline( case VK_PIPELINE_BIND_POINT_COMPUTE: cmd_buffer->state.compute_pipeline = pipeline; cmd_buffer->state.compute_dirty |= ANV_CMD_BUFFER_PIPELINE_DIRTY; + cmd_buffer->state.push_constants_dirty |= VK_SHADER_STAGE_COMPUTE_BIT; break; case VK_PIPELINE_BIND_POINT_GRAPHICS: cmd_buffer->state.pipeline = pipeline; cmd_buffer->state.vb_dirty |= pipeline->vb_used; cmd_buffer->state.dirty |= ANV_CMD_BUFFER_PIPELINE_DIRTY; + cmd_buffer->state.push_constants_dirty |= pipeline->active_stages; break; default: @@ -665,7 +669,22 @@ void anv_CmdPushConstants( uint32_t length, const void* values) { - stub(); + ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer); + uint32_t stage; + + for_each_bit(stage, stageFlags) { + if (cmd_buffer->state.push_constants[stage].data == NULL) { + cmd_buffer->state.push_constants[stage].data = + anv_device_alloc(cmd_buffer->device, + sizeof(struct anv_push_constant_data), 8, + VK_SYSTEM_ALLOC_TYPE_INTERNAL); + } + + memcpy(cmd_buffer->state.push_constants[stage].data->client_data + start, + values, length); + } + + cmd_buffer->state.push_constants_dirty |= stageFlags; } void anv_CmdExecuteCommands( |