@@ -74,7 +74,7 @@ alloc_shader_storage(BeamformerCtx *ctx, Arena a)
74
74
75
75
glBindBuffer (GL_SHADER_STORAGE_BUFFER , cs -> raw_data_ssbo );
76
76
glBufferStorage (GL_SHADER_STORAGE_BUFFER , ARRAY_COUNT (cs -> raw_data_fences ) * rf_raw_size ,
77
- 0 , GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT );
77
+ 0 , GL_MAP_WRITE_BIT );
78
78
79
79
for (u32 i = 0 ; i < ARRAY_COUNT (cs -> rf_data_ssbos ); i ++ ) {
80
80
glBindBuffer (GL_SHADER_STORAGE_BUFFER , cs -> rf_data_ssbos [i ]);
@@ -523,7 +523,7 @@ do_beamformer(BeamformerCtx *ctx, Arena arena)
523
523
}
524
524
525
525
/* NOTE: Store the compute time for the last frame. */
526
- {
526
+ if ( ctx -> csctx . timer_fence ) {
527
527
i32 timer_status , _unused ;
528
528
glGetSynciv (ctx -> csctx .timer_fence , GL_SYNC_STATUS , 4 , & _unused , & timer_status );
529
529
if (timer_status == GL_SIGNALED ) {
@@ -546,11 +546,14 @@ do_beamformer(BeamformerCtx *ctx, Arena arena)
546
546
i32 raw_index = ctx -> csctx .raw_data_index ;
547
547
/* NOTE: if this times out it means the command queue is more than 3 frames behind.
548
548
* In that case we need to re-evaluate the buffer size */
549
- i32 result = glClientWaitSync (ctx -> csctx .raw_data_fences [raw_index ], 0 , 10000 );
550
- if (result == GL_TIMEOUT_EXPIRED ) {
551
- //ASSERT(0);
549
+ if (ctx -> csctx .raw_data_fences [raw_index ]) {
550
+ i32 result = glClientWaitSync (ctx -> csctx .raw_data_fences [raw_index ], 0 , 10000 );
551
+ if (result == GL_TIMEOUT_EXPIRED ) {
552
+ //ASSERT(0);
553
+ }
554
+ glDeleteSync (ctx -> csctx .raw_data_fences [raw_index ]);
555
+ ctx -> csctx .raw_data_fences [raw_index ] = NULL ;
552
556
}
553
- glDeleteSync (ctx -> csctx .raw_data_fences [raw_index ]);
554
557
555
558
uv2 rf_raw_dim = ctx -> csctx .rf_raw_dim ;
556
559
size rf_raw_size = rf_raw_dim .x * rf_raw_dim .y * sizeof (i16 );
0 commit comments