Skip to content

Commit

Permalink
Vulkan: fixed various image layout transition synchronization issues
Browse files Browse the repository at this point in the history
Vulkan: applied fixes to some "Best Practices" validation layer errors
  • Loading branch information
ec- committed Feb 3, 2024
1 parent 93cb470 commit 82ed885
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 74 deletions.
4 changes: 1 addition & 3 deletions code/qcommon/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -4688,16 +4688,14 @@ static void FS_Startup( void ) {
/* set up basegame on last item from the list */
basegame = basegames[0];
for (i = 1; i < basegame_cnt; i++) {
if ( basegames[i] != '\0' ) {
if ( *basegames[i] != '\0' ) {
basegame = basegames[i];
}
}

if ( fs_basegame->string[0] == '\0' || *basegame == '\0' || basegame_cnt == 0 )
Com_Error( ERR_FATAL, "* fs_basegame is not set *" );

Com_Printf( S_COLOR_YELLOW "basegame set to '%s'\n", basegame );

#ifndef USE_HANDLE_CACHE
fs_locked = Cvar_Get( "fs_locked", "0", CVAR_INIT );
Cvar_SetDescription( fs_locked, "Set file handle policy for pk3 files:\n"
Expand Down
8 changes: 5 additions & 3 deletions code/renderervk/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ void RE_UploadCinematic( int w, int h, int cols, int rows, byte *data, int clien
image->height = image->uploadHeight = rows;
#ifdef USE_VULKAN
vk_create_image( image, cols, rows, 1 );
vk_upload_image_data( image, 0, 0, cols, rows, 1, data, cols * rows * 4 );
vk_upload_image_data( image, 0, 0, cols, rows, 1, data, cols * rows * 4, qfalse );
#else
qglTexImage2D( GL_TEXTURE_2D, 0, image->internalFormat, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
qglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
Expand All @@ -1129,7 +1129,7 @@ void RE_UploadCinematic( int w, int h, int cols, int rows, byte *data, int clien
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
// it and don't try and do a texture compression
#ifdef USE_VULKAN
vk_upload_image_data( image, 0, 0, cols, rows, 1, data, cols * rows * 4 );
vk_upload_image_data( image, 0, 0, cols, rows, 1, data, cols * rows * 4, qtrue );
#else
qglTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, cols, rows, GL_RGBA, GL_UNSIGNED_BYTE, data );
#endif
Expand Down Expand Up @@ -1732,7 +1732,9 @@ static const void *RB_SwapBuffers( const void *data ) {
backEnd.screenshotMask = 0;
}

#ifndef USE_VULKAN
#ifdef USE_VULKAN
vk_present_frame();
#else
ri.GLimp_EndFrame();
#endif

Expand Down
2 changes: 1 addition & 1 deletion code/renderervk/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static void R_LoadMergedLightmaps( const lump_t *l, byte *image )
R_ProcessLightmap( image, buf + offs, maxIntensity );

#ifdef USE_VULKAN
vk_upload_image_data( tr.lightmaps[ i ], x * LIGHTMAP_LEN, y * LIGHTMAP_LEN, LIGHTMAP_LEN, LIGHTMAP_LEN, 1, image, LIGHTMAP_LEN * LIGHTMAP_LEN * 4 );
vk_upload_image_data( tr.lightmaps[ i ], x * LIGHTMAP_LEN, y * LIGHTMAP_LEN, LIGHTMAP_LEN, LIGHTMAP_LEN, 1, image, LIGHTMAP_LEN * LIGHTMAP_LEN * 4, qtrue );
#else
R_UploadSubImage( image, x * LIGHTMAP_LEN, y * LIGHTMAP_LEN, LIGHTMAP_LEN, LIGHTMAP_LEN, tr.lightmaps[ i ] );
#endif
Expand Down
2 changes: 1 addition & 1 deletion code/renderervk/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ static void upload_vk_image( image_t *image, byte *pic ) {
image->uploadHeight = h;

vk_create_image( image, w, h, upload_data.mip_levels );
vk_upload_image_data( image, 0, 0, w, h, upload_data.mip_levels, upload_data.buffer, upload_data.buffer_size );
vk_upload_image_data( image, 0, 0, w, h, upload_data.mip_levels, upload_data.buffer, upload_data.buffer_size, qfalse );

ri.Hunk_FreeTempMemory( upload_data.buffer );
}
Expand Down
Loading

0 comments on commit 82ed885

Please sign in to comment.