Fix for allocation problems
- Double allocation because of missing break
This commit is contained in:
		
							parent
							
								
									8dc4f794b3
								
							
						
					
					
						commit
						36e2314f35
					
				@ -49,7 +49,7 @@ typedef struct {
 | 
			
		||||
 | 
			
		||||
RT_CVAR_S(rt_AssetDirectory, "Name of the asset directory. Default: assets", "assets");
 | 
			
		||||
RT_CVAR_I(rt_AssetDBSize, "Size of the asset database. Default: 1024", 1024);
 | 
			
		||||
RT_CVAR_I(rt_AssetProcessingThreads, "Number of asset processing threads. Default: 4", 1);
 | 
			
		||||
RT_CVAR_I(rt_AssetProcessingThreads, "Number of asset processing threads. Default: 4", 4);
 | 
			
		||||
RT_CVAR_I(rt_AssetProcessorArenaSize,
 | 
			
		||||
          "Size of the per-thread asset processor arena. Default: 128 MiB",
 | 
			
		||||
          (int)RT_MB(128));
 | 
			
		||||
@ -421,6 +421,7 @@ rt_loaded_asset LoadAsset(rt_file_id file) {
 | 
			
		||||
        rtLog("AC", "Failed to allocate buffer for loading %s.", path);
 | 
			
		||||
        return (rt_loaded_asset){.buffer = NULL, .size = 0};
 | 
			
		||||
    }
 | 
			
		||||
    rtLog("AC", "Allocated %p for %s", buffer, path);
 | 
			
		||||
 | 
			
		||||
    rt_aio_state load_state = rtSubmitSingleLoadSync((rt_file_load){
 | 
			
		||||
        .file      = file,
 | 
			
		||||
 | 
			
		||||
@ -504,6 +504,7 @@ RT_ASSET_PROCESSOR_FN(PipelineProcessor) {
 | 
			
		||||
        *new_resource_count = 1 + pipeline.shader_count;
 | 
			
		||||
    }
 | 
			
		||||
out:
 | 
			
		||||
    rtLog("AC", "Released %p", asset.buffer);
 | 
			
		||||
    rtReleaseBuffer(asset.buffer, asset.size);
 | 
			
		||||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -103,6 +103,7 @@ RT_DLLEXPORT void *rtAllocBuffer(size_t size) {
 | 
			
		||||
            _bitmap[dword] |= mask;
 | 
			
		||||
            result      = _memory + i * BLOCK_SIZE;
 | 
			
		||||
            first_block = i;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        else if (lzcnt32(_bitmap[dword]) >= alloc_blocks) {
 | 
			
		||||
            size_t first = (_bitmap[dword] != 0) ? 32 - lzcnt32(_bitmap[dword]) : 0;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user