vk: Move vertex buffers into struct anv_bindings
This commit is contained in:
@@ -2239,8 +2239,8 @@ void VKAPI vkCmdBindVertexBuffers(
|
||||
* stride from the pipeline. */
|
||||
|
||||
for (uint32_t i = 0; i < bindingCount; i++) {
|
||||
cmd_buffer->vb[startBinding + i].buffer = (struct anv_buffer *) pBuffers[i];
|
||||
cmd_buffer->vb[startBinding + i].offset = pOffsets[i];
|
||||
cmd_buffer->bindings.vb[startBinding + i].buffer = (struct anv_buffer *) pBuffers[i];
|
||||
cmd_buffer->bindings.vb[startBinding + i].offset = pOffsets[i];
|
||||
cmd_buffer->vb_dirty |= 1 << (startBinding + i);
|
||||
}
|
||||
}
|
||||
@@ -2335,8 +2335,8 @@ anv_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer)
|
||||
GEN8_3DSTATE_VERTEX_BUFFERS);
|
||||
uint32_t vb, i = 0;
|
||||
for_each_bit(vb, cmd_buffer->vb_dirty) {
|
||||
struct anv_buffer *buffer = cmd_buffer->vb[vb].buffer;
|
||||
uint32_t offset = cmd_buffer->vb[vb].offset;
|
||||
struct anv_buffer *buffer = cmd_buffer->bindings.vb[vb].buffer;
|
||||
uint32_t offset = cmd_buffer->bindings.vb[vb].offset;
|
||||
|
||||
struct GEN8_VERTEX_BUFFER_STATE state = {
|
||||
.VertexBufferIndex = vb,
|
||||
|
@@ -146,11 +146,8 @@ anv_device_init_meta_clear_state(struct anv_device *device)
|
||||
&device->clear_state.rs_state);
|
||||
}
|
||||
|
||||
#define NUM_VB_USED 2
|
||||
struct anv_saved_state {
|
||||
struct {
|
||||
struct anv_buffer *buffer;
|
||||
VkDeviceSize offset;
|
||||
} vb[2];
|
||||
struct anv_bindings bindings;
|
||||
struct anv_pipeline *pipeline;
|
||||
};
|
||||
@@ -159,7 +156,6 @@ static void
|
||||
anv_cmd_buffer_save(struct anv_cmd_buffer *cmd_buffer,
|
||||
struct anv_saved_state *state)
|
||||
{
|
||||
memcpy(state->vb, cmd_buffer->vb, sizeof(state->vb));
|
||||
memcpy(&state->bindings, &cmd_buffer->bindings, sizeof(state->bindings));
|
||||
state->pipeline = cmd_buffer->pipeline;
|
||||
}
|
||||
@@ -168,11 +164,10 @@ static void
|
||||
anv_cmd_buffer_restore(struct anv_cmd_buffer *cmd_buffer,
|
||||
const struct anv_saved_state *state)
|
||||
{
|
||||
memcpy(cmd_buffer->vb, state->vb, sizeof(state->vb));
|
||||
memcpy(&cmd_buffer->bindings, &state->bindings, sizeof(state->bindings));
|
||||
cmd_buffer->pipeline = state->pipeline;
|
||||
|
||||
cmd_buffer->vb_dirty |= (1 << ARRAY_SIZE(state->vb)) - 1;
|
||||
cmd_buffer->vb_dirty |= (1 << NUM_VB_USED) - 1;
|
||||
cmd_buffer->dirty |= ANV_CMD_BUFFER_PIPELINE_DIRTY |
|
||||
ANV_CMD_BUFFER_DESCRIPTOR_SET_DIRTY;
|
||||
}
|
||||
|
@@ -507,6 +507,11 @@ struct anv_buffer {
|
||||
#define ANV_CMD_BUFFER_RS_DIRTY (1 << 2)
|
||||
|
||||
struct anv_bindings {
|
||||
struct {
|
||||
struct anv_buffer *buffer;
|
||||
VkDeviceSize offset;
|
||||
} vb[MAX_VBS];
|
||||
|
||||
struct {
|
||||
uint32_t surfaces[256];
|
||||
struct {
|
||||
@@ -532,10 +537,6 @@ struct anv_cmd_buffer {
|
||||
struct anv_state_stream dynamic_state_stream;
|
||||
|
||||
/* State required while building cmd buffer */
|
||||
struct {
|
||||
struct anv_buffer *buffer;
|
||||
VkDeviceSize offset;
|
||||
} vb[MAX_VBS];
|
||||
uint32_t vb_dirty;
|
||||
uint32_t dirty;
|
||||
struct anv_pipeline * pipeline;
|
||||
|
Reference in New Issue
Block a user