replace debuffer with flipping one where possible

This commit is contained in:
Ivan 'provod' Avdeev 2022-06-26 00:52:22 -07:00 committed by Ivan Avdeev
parent c299ac9ccd
commit b634d6251e
2 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ static struct {
VkPipeline pipelines[kRenderTransAdd + 1];
vk_buffer_t pics_buffer;
r_debuffer_t pics_buffer_alloc;
r_flipping_buffer_t pics_buffer_alloc;
qboolean exhausted_this_frame;
batch_t batch[MAX_BATCHES];
@ -45,7 +45,7 @@ static struct {
} g2d;
static vertex_2d_t* allocQuadVerts(int blending_mode, int texnum) {
const uint32_t pics_offset = R_DEBuffer_Alloc(&g2d.pics_buffer_alloc, LifetimeDynamic, 6, 1);
const uint32_t pics_offset = R_FlippingBuffer_Alloc(&g2d.pics_buffer_alloc, 6, 1);
vertex_2d_t* const ptr = ((vertex_2d_t*)(g2d.pics_buffer.mapped)) + pics_offset;
batch_t *batch = g2d.batch + (g2d.batch_count-1);
@ -125,7 +125,7 @@ static void drawFill( float x, float y, float w, float h, int r, int g, int b, i
}
static void clearAccumulated( void ) {
R_DEBuffer_Flip(&g2d.pics_buffer_alloc);
R_FlippingBuffer_Flip(&g2d.pics_buffer_alloc);
g2d.batch_count = 1;
g2d.batch[0].texture = -1;
@ -239,7 +239,7 @@ qboolean R_VkOverlay_Init( void ) {
// FIXME cleanup
return false;
R_DEBuffer_Init(&g2d.pics_buffer_alloc, 0, MAX_VERTICES);
R_FlippingBuffer_Init(&g2d.pics_buffer_alloc, MAX_VERTICES);
return true;
}

View File

@ -144,7 +144,7 @@ static struct {
// Needs: SHADER_DEVICE_ADDRESS, STORAGE_BUFFER, AS_BUILD_INPUT_READ_ONLY
vk_buffer_t tlas_geom_buffer;
VkDeviceAddress tlas_geom_buffer_addr;
r_debuffer_t tlas_geom_buffer_alloc;
r_flipping_buffer_t tlas_geom_buffer_alloc;
// Planned to contain seveal types of data:
// - grid structure itself
@ -583,9 +583,9 @@ static void prepareTlas( VkCommandBuffer cmdbuf ) {
ASSERT(g_ray_model_state.frame.num_models > 0);
DEBUG_BEGIN(cmdbuf, "prepare tlas");
R_DEBuffer_Flip( &g_rtx.tlas_geom_buffer_alloc );
R_FlippingBuffer_Flip( &g_rtx.tlas_geom_buffer_alloc );
const uint32_t instance_offset = R_DEBuffer_Alloc(&g_rtx.tlas_geom_buffer_alloc, LifetimeDynamic, g_ray_model_state.frame.num_models, 1);
const uint32_t instance_offset = R_FlippingBuffer_Alloc(&g_rtx.tlas_geom_buffer_alloc, g_ray_model_state.frame.num_models, 1);
ASSERT(instance_offset != ALO_ALLOC_FAILED);
// Upload all blas instances references to GPU mem
@ -1360,7 +1360,7 @@ qboolean VK_RayInit( void )
return false;
}
g_rtx.tlas_geom_buffer_addr = getBufferDeviceAddress(g_rtx.tlas_geom_buffer.buffer);
R_DEBuffer_Init(&g_rtx.tlas_geom_buffer_alloc, 0, MAX_ACCELS * 2);
R_FlippingBuffer_Init(&g_rtx.tlas_geom_buffer_alloc, MAX_ACCELS * 2);
if (!VK_BufferCreate("ray kusochki_buffer", &g_ray_model_state.kusochki_buffer, sizeof(vk_kusok_data_t) * MAX_KUSOCHKI,
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT /* | VK_BUFFER_USAGE_TRANSFER_DST_BIT */,