Formatted code with Astyle

This commit is contained in:
Robert Beckebans 2022-02-12 12:55:46 +01:00
parent 4bba6b3e46
commit c23709c2db
16 changed files with 281 additions and 281 deletions

View file

@ -931,7 +931,7 @@ void idCommonLocal::RenderBink( const char* path )
material->Parse( materialText.c_str(), materialText.Length(), false );
material->ResetCinematicTime( Sys_Milliseconds() );
// SRS - Restored original calculation after implementing idCinematicLocal::GetStartTime() and fixing animationLength in idCinematicLocal::InitFromBinkDecFile()
// SRS - Restored original calculation after implementing idCinematicLocal::GetStartTime() and fixing animationLength in idCinematicLocal::InitFromBinkDecFile()
int cinematicLength = material->CinematicLength();
int mouseEvents[MAX_MOUSE_EVENTS][2];

View file

@ -312,7 +312,7 @@ idCommonLocal::TimeRenderDemo
*/
void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit )
{
extern idCVar com_smp;
extern idCVar com_smp;
idStr demo = demoName;
StartPlayingRenderDemo( demo );
@ -320,29 +320,29 @@ void idCommonLocal::TimeRenderDemo( const char* demoName, bool twice, bool quit
if( twice && readDemo )
{
timeDemo = TD_YES; // SRS - Set timeDemo to TD_YES to disable time demo playback pause when window not in focus
int smp_mode = com_smp.GetInteger();
com_smp.SetInteger( 0 ); // SRS - First pass of timedemo is effectively in com_smp == 0 mode, so set this for ImGui timings to be correct
int smp_mode = com_smp.GetInteger();
com_smp.SetInteger( 0 ); // SRS - First pass of timedemo is effectively in com_smp == 0 mode, so set this for ImGui timings to be correct
while( readDemo )
{
BusyWait(); // SRS - BusyWait() calls UpdateScreen() which draws and renders out-of-sequence but still supports frame timing
commonLocal.frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
commonLocal.mainFrameTiming = commonLocal.frameTiming;
// ** End of current logical frame **
// ** Start of next logical frame **
commonLocal.frameTiming.startSyncTime = Sys_Microseconds();
commonLocal.frameTiming.finishSyncTime = commonLocal.frameTiming.startSyncTime;
commonLocal.frameTiming.startGameTime = commonLocal.frameTiming.finishSyncTime;
commonLocal.frameTiming.finishSyncTime_EndFrame = Sys_Microseconds();
commonLocal.mainFrameTiming = commonLocal.frameTiming;
// ** End of current logical frame **
AdvanceRenderDemo( true ); // SRS - Advance demo commands to manually run the next game frame during first pass of the timedemo
commonLocal.frameTiming.finishGameTime = Sys_Microseconds();
eventLoop->RunEventLoop( false ); // SRS - Run event loop (with no commands) to allow keyboard escape to cancel first pass of the timedemo
// ** Start of next logical frame **
commonLocal.frameTiming.startSyncTime = Sys_Microseconds();
commonLocal.frameTiming.finishSyncTime = commonLocal.frameTiming.startSyncTime;
commonLocal.frameTiming.startGameTime = commonLocal.frameTiming.finishSyncTime;
AdvanceRenderDemo( true ); // SRS - Advance demo commands to manually run the next game frame during first pass of the timedemo
commonLocal.frameTiming.finishGameTime = Sys_Microseconds();
eventLoop->RunEventLoop( false ); // SRS - Run event loop (with no commands) to allow keyboard escape to cancel first pass of the timedemo
}
com_smp.SetInteger( smp_mode ); // SRS - Restore original com_smp mode before second pass of timedemo which runs within normal rendering loop
com_smp.SetInteger( smp_mode ); // SRS - Restore original com_smp mode before second pass of timedemo which runs within normal rendering loop
StartPlayingRenderDemo( demo );
}

View file

@ -427,7 +427,7 @@ void idCommonLocal::UpdateScreen( bool captureToImage, bool releaseMouse )
// build all the draw commands without running a new game tic
Draw();
frameTiming.finishDrawTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
frameTiming.finishDrawTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
// foresthale 2014-03-01: note: the only place that has captureToImage=true is idAutoRender::StartBackgroundAutoSwaps
if( captureToImage )
@ -439,9 +439,9 @@ void idCommonLocal::UpdateScreen( bool captureToImage, bool releaseMouse )
const emptyCommand_t* cmd = renderSystem->SwapCommandBuffers( &time_frontend, &time_backend, &time_shadows, &time_gpu, &stats_backend, &stats_frontend );
// get the GPU busy with new commands
frameTiming.startRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
frameTiming.startRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
renderSystem->RenderCommandBuffers( cmd );
frameTiming.finishRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
frameTiming.finishRenderTime = Sys_Microseconds(); // SRS - Added frame timing for out-of-sequence updates (e.g. used in timedemo "twice" mode)
insideUpdateScreen = false;
}

View file

@ -79,14 +79,14 @@ bool hasplanar = true;
#endif
#ifdef USE_BINKDEC
// DG: not sure how to use FFMPEG and BINKDEC at the same time.. it might be useful if someone wants to
// use binkdec for bink and FFMPEG for other formats in custom code so I didn't just rip FFMPEG out
// But right now it's unsupported, if you need this adjust the video loading code etc yourself
#ifdef USE_FFMPEG
#error "Currently, only one of FFMPEG and BINKDEC is supported at a time!"
#endif
// DG: not sure how to use FFMPEG and BINKDEC at the same time.. it might be useful if someone wants to
// use binkdec for bink and FFMPEG for other formats in custom code so I didn't just rip FFMPEG out
// But right now it's unsupported, if you need this adjust the video loading code etc yourself
#ifdef USE_FFMPEG
#error "Currently, only one of FFMPEG and BINKDEC is supported at a time!"
#endif
#include <BinkDecoder.h>
#include <BinkDecoder.h>
#endif // USE_BINKDEC
class idCinematicLocal : public idCinematic
@ -102,9 +102,9 @@ public:
bool IsPlaying() const;
// RB end
virtual void Close();
// SRS begin
virtual int GetStartTime();
// SRS end
// SRS begin
virtual int GetStartTime();
// SRS end
virtual void ResetTime( int time );
private:
@ -143,7 +143,7 @@ private:
void BinkDecReset();
YUVbuffer yuvBuffer;
bool hasFrame;
bool hasFrame;
int framePos;
int numFrames;
idImage* imgY;
@ -220,7 +220,7 @@ private:
void RoQPrepMcomp( int xoff, int yoff );
void RoQReset();
// RB end
//GK:Also init variables for XAudio2 or OpenAL (SRS - this must be an instance variable)
CinematicAudio* cinematicAudio;
};
@ -433,7 +433,7 @@ idCinematicLocal::idCinematicLocal()
qStatus[0] = ( byte** )Mem_Alloc( 32768 * sizeof( byte* ), TAG_CINEMATIC );
qStatus[1] = ( byte** )Mem_Alloc( 32768 * sizeof( byte* ), TAG_CINEMATIC );
isRoQ = false; // SRS - Initialize isRoQ for all cases, not just FFMPEG
isRoQ = false; // SRS - Initialize isRoQ for all cases, not just FFMPEG
#if defined(USE_FFMPEG)
// Carl: ffmpeg stuff, for bink and normal video files:
// fmt_ctx = avformat_alloc_context();
@ -453,14 +453,14 @@ idCinematicLocal::idCinematicLocal()
audio_stream_index = -1;
img_convert_ctx = NULL;
hasFrame = false;
framePos = -1;
framePos = -1;
lagIndex = 0;
#endif
#ifdef USE_BINKDEC
binkHandle.isValid = false;
binkHandle.instanceIndex = -1; // whatever this is, it now has a deterministic value
hasFrame = false;
hasFrame = false;
framePos = -1;
numFrames = 0;
audioTracks = 0;
@ -548,7 +548,7 @@ idCinematicLocal::~idCinematicLocal()
av_freep( &frame2 );
av_freep( &frame3 );
#endif
// SRS - Free any lagged cinematic audio buffers
for( int i = 0; i < NUM_LAG_FRAMES; i++ )
{
@ -797,11 +797,11 @@ bool idCinematicLocal::InitFromFFMPEGFile( const char* qpath, bool amilooping )
sws_freeContext( img_convert_ctx );
}
img_convert_ctx = sws_getContext( dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt, CIN_WIDTH, CIN_HEIGHT, AV_PIX_FMT_BGR32, SWS_BICUBIC, NULL, NULL, NULL );
buf = NULL;
status = FMV_PLAY;
hasFrame = false;
framePos = -1;
buf = NULL;
status = FMV_PLAY;
hasFrame = false;
framePos = -1;
ImageForTime( 0 );
status = ( looping ) ? FMV_PLAY : FMV_IDLE;
@ -897,15 +897,15 @@ bool idCinematicLocal::InitFromBinkDecFile( const char* qpath, bool amilooping )
float durationSec = numFrames / frameRate; // SRS - fixed Bink durationSec calculation
animationLength = durationSec * 1000; // SRS - animationLength is in milliseconds
common->Printf( "Loaded BinkDec file: '%s', looping=%d, %dx%d, %f FPS, %f sec\n", qpath, looping, CIN_WIDTH, CIN_HEIGHT, frameRate, durationSec );
memset( yuvBuffer, 0, sizeof( yuvBuffer ) );
buf = NULL;
status = FMV_PLAY;
hasFrame = false; // SRS - Implemented hasFrame for BinkDec behaviour consistency with FFMPEG
framePos = -1;
ImageForTime( 0 ); // SRS - Was missing initial call to ImageForTime() - fixes validation errors when using Vulkan renderer
status = ( looping ) ? FMV_PLAY : FMV_IDLE; // SRS - Update status based on looping flag
memset( yuvBuffer, 0, sizeof( yuvBuffer ) );
buf = NULL;
status = FMV_PLAY;
hasFrame = false; // SRS - Implemented hasFrame for BinkDec behaviour consistency with FFMPEG
framePos = -1;
ImageForTime( 0 ); // SRS - Was missing initial call to ImageForTime() - fixes validation errors when using Vulkan renderer
status = ( looping ) ? FMV_PLAY : FMV_IDLE; // SRS - Update status based on looping flag
return true;
}
@ -967,7 +967,7 @@ bool idCinematicLocal::InitFromFile( const char* qpath, bool amilooping )
#elif defined(USE_BINKDEC)
idStr temp = fileName.StripFileExtension() + ".bik";
animationLength = 0;
hasFrame = false;
hasFrame = false;
RoQShutdown();
fileName = temp;
//idLib::Warning( "New filename: '%s'\n", fileName.c_str() );
@ -1054,15 +1054,15 @@ void idCinematicLocal::Close()
}
#endif
#ifdef USE_BINKDEC
hasFrame = false;
hasFrame = false;
if( !isRoQ )
{
if( binkHandle.isValid )
{
memset( yuvBuffer, 0 , sizeof( yuvBuffer ) );
Bink_Close( binkHandle );
}
if( binkHandle.isValid )
{
memset( yuvBuffer, 0 , sizeof( yuvBuffer ) );
Bink_Close( binkHandle );
}
status = FMV_EOF;
}
#endif
@ -1093,7 +1093,7 @@ bool idCinematicLocal::IsPlaying() const
*/
int idCinematicLocal::GetStartTime()
{
return startTime;
return startTime;
}
// SRS end
@ -1252,7 +1252,7 @@ cinData_t idCinematicLocal::ImageForTimeFFMPEG( int thisTime )
cinData_t cinData;
uint8_t* audioBuffer = NULL;
int num_bytes = 0;
if( thisTime <= 0 )
{
thisTime = Sys_Milliseconds();
@ -1421,7 +1421,7 @@ cinData_t idCinematicLocal::ImageForTimeFFMPEG( int thisTime )
img->UploadScratch( image, CIN_WIDTH, CIN_HEIGHT );
hasFrame = true;
cinData.image = img;
// SRS - If we have cinematic audio data, play a lagged frame (for FFMPEG video sync) and save the current frame
if( num_bytes > 0 )
{
@ -1456,7 +1456,7 @@ cinData_t idCinematicLocal::ImageForTimeBinkDec( int thisTime )
thisTime = Sys_Milliseconds();
}
memset( &cinData, 0, sizeof( cinData ) );
memset( &cinData, 0, sizeof( cinData ) );
if( r_skipDynamicTextures.GetBool() || status == FMV_EOF || status == FMV_IDLE )
{
return cinData;
@ -1468,13 +1468,13 @@ cinData_t idCinematicLocal::ImageForTimeBinkDec( int thisTime )
return cinData;
}
// SRS - Implement hasFrame so BinkDec startTime is handled the same as with FFMPEG
// SRS - Implement hasFrame so BinkDec startTime is handled the same as with FFMPEG
if( ( !hasFrame ) || startTime == -1 )
{
if( startTime == -1 )
{
BinkDecReset();
}
if( startTime == -1 )
{
BinkDecReset();
}
startTime = thisTime;
}
@ -1502,12 +1502,12 @@ cinData_t idCinematicLocal::ImageForTimeBinkDec( int thisTime )
}
}
// SRS - Enable video replay within PDAs
if( desiredFrame < framePos )
{
BinkDecReset();
}
// SRS end
// SRS - Enable video replay within PDAs
if( desiredFrame < framePos )
{
BinkDecReset();
}
// SRS end
if( hasFrame && desiredFrame == framePos )
{
@ -1554,9 +1554,9 @@ cinData_t idCinematicLocal::ImageForTimeBinkDec( int thisTime )
else if( h < CIN_HEIGHT )
{
#if defined(__APPLE__) && defined(USE_VULKAN)
// SRS - For U and V channels on OSX Vulkan use full height image to work around stall that occurs with half-height chroma planes
// when exiting levels or returning from demo playback - depends on OSX-specific logic inside Vulkan version of SubImageUpload()
h = CIN_HEIGHT;
// SRS - For U and V channels on OSX Vulkan use full height image to work around stall that occurs with half-height chroma planes
// when exiting levels or returning from demo playback - depends on OSX-specific logic inside Vulkan version of SubImageUpload()
h = CIN_HEIGHT;
#else
// the U and V channels have a lower resolution than the Y channel
// (or the logical video resolution), so use the aspect ratio to
@ -1579,7 +1579,7 @@ cinData_t idCinematicLocal::ImageForTimeBinkDec( int thisTime )
img->SubImageUpload( 0, 0, 0, 0, w, h, yuvBuffer[i].data );
}
hasFrame = true;
hasFrame = true;
cinData.imageY = imgY;
cinData.imageCr = imgCr;
cinData.imageCb = imgCb;

View file

@ -206,11 +206,11 @@ static void R_CheckPortableExtensions()
{
glConfig.vendor = VENDOR_INTEL;
}
// SRS - Added support for Apple GPUs
else if( idStr::Icmpn( glConfig.vendor_string, "Apple", 5 ) == 0 || idStr::Icmpn( glConfig.renderer_string, "Apple", 5 ) == 0 )
{
glConfig.vendor = VENDOR_APPLE;
}
// SRS - Added support for Apple GPUs
else if( idStr::Icmpn( glConfig.vendor_string, "Apple", 5 ) == 0 || idStr::Icmpn( glConfig.renderer_string, "Apple", 5 ) == 0 )
{
glConfig.vendor = VENDOR_APPLE;
}
// RB: Mesa support
if( idStr::Icmpn( glConfig.renderer_string, "Mesa", 4 ) == 0 || idStr::Icmpn( glConfig.renderer_string, "X.org", 5 ) == 0 || idStr::Icmpn( glConfig.renderer_string, "Gallium", 7 ) == 0 ||

View file

@ -164,7 +164,7 @@ struct vulkanContext_t
bool debugMarkerSupportAvailable;
bool debugUtilsSupportAvailable;
bool deviceProperties2Available; // SRS - For getting device properties in support of gfxInfo
bool deviceProperties2Available; // SRS - For getting device properties in support of gfxInfo
// selected GPU
gpuInfo_t* gpu;

View file

@ -110,19 +110,19 @@ void PC_BeginNamedEvent( const char* szName, const idVec4& color )
#if defined( USE_VULKAN )
// start an annotated group of calls under the this name
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
if( vkcontext.debugUtilsSupportAvailable )
{
VkDebugUtilsLabelEXT label = {};
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
label.pLabelName = szName;
label.color[0] = color.x;
label.color[1] = color.y;
label.color[2] = color.z;
label.color[3] = color.w;
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
if( vkcontext.debugUtilsSupportAvailable )
{
VkDebugUtilsLabelEXT label = {};
label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
label.pLabelName = szName;
label.color[0] = color.x;
label.color[1] = color.y;
label.color[2] = color.z;
label.color[3] = color.w;
qvkCmdBeginDebugUtilsLabelEXT( vkcontext.commandBuffer[ vkcontext.frameParity ], &label );
}
qvkCmdBeginDebugUtilsLabelEXT( vkcontext.commandBuffer[ vkcontext.frameParity ], &label );
}
else if( vkcontext.debugMarkerSupportAvailable )
{
VkDebugMarkerMarkerInfoEXT label = {};
@ -191,11 +191,11 @@ PC_EndNamedEvent
void PC_EndNamedEvent()
{
#if defined( USE_VULKAN )
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
if( vkcontext.debugUtilsSupportAvailable )
{
qvkCmdEndDebugUtilsLabelEXT( vkcontext.commandBuffer[ vkcontext.frameParity ] );
}
// SRS - Prefer VK_EXT_debug_utils over VK_EXT_debug_marker/VK_EXT_debug_report (deprecated by VK_EXT_debug_utils)
if( vkcontext.debugUtilsSupportAvailable )
{
qvkCmdEndDebugUtilsLabelEXT( vkcontext.commandBuffer[ vkcontext.frameParity ] );
}
else if( vkcontext.debugMarkerSupportAvailable )
{
qvkCmdDebugMarkerEndEXT( vkcontext.commandBuffer[ vkcontext.frameParity ] );

View file

@ -84,7 +84,7 @@ enum graphicsVendor_t
VENDOR_NVIDIA,
VENDOR_AMD,
VENDOR_INTEL,
VENDOR_APPLE // SRS - Added support for Apple GPUs
VENDOR_APPLE // SRS - Added support for Apple GPUs
};
// RB: similar to Q3A - allow separate codepaths between OpenGL 3.x, OpenGL ES versions

View file

@ -65,7 +65,7 @@ uint32 FindMemoryTypeIndex( const uint32 memoryTypeBits, const vulkanMemoryUsage
VkMemoryPropertyFlags required = 0;
VkMemoryPropertyFlags preferred = 0;
VkMemoryHeapFlags avoid = 0;
VkMemoryHeapFlags avoid = 0;
switch( usage )
{
@ -74,20 +74,20 @@ uint32 FindMemoryTypeIndex( const uint32 memoryTypeBits, const vulkanMemoryUsage
break;
case VULKAN_MEMORY_USAGE_CPU_ONLY:
required |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoid |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoid |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
break;
case VULKAN_MEMORY_USAGE_CPU_TO_GPU:
required |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
preferred |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoid |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoid |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
break;
case VULKAN_MEMORY_USAGE_GPU_TO_CPU:
required |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
preferred |= VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoid |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoid |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
break;
default:
idLib::FatalError( "idVulkanAllocator::AllocateFromPools: Unknown memory usage." );
@ -661,11 +661,11 @@ idVulkanAllocator::Free
*/
void idVulkanAllocator::Free( const vulkanAllocation_t allocation )
{
// SRS - Make sure we are trying to free an actual allocated block, otherwise skip
if( allocation.block != NULL )
{
garbage[ garbageIndex ].Append( allocation );
}
// SRS - Make sure we are trying to free an actual allocated block, otherwise skip
if( allocation.block != NULL )
{
garbage[ garbageIndex ].Append( allocation );
}
}
/*
@ -741,10 +741,10 @@ CONSOLE_COMMAND( Vulkan_PrintHeapInfo, "Print out the heap information for this
{
idLib::Printf( "HOST_VISIBLE" );
}
if( heap.flags & VK_MEMORY_HEAP_MULTI_INSTANCE_BIT )
{
idLib::Printf( ", MULTI_INSTANCE" );
}
if( heap.flags & VK_MEMORY_HEAP_MULTI_INSTANCE_BIT )
{
idLib::Printf( ", MULTI_INSTANCE" );
}
idLib::Printf( "\n" );
for( uint32 j = 0; j < props.memoryTypeCount; ++j )

View file

@ -106,7 +106,7 @@ bool idVertexBuffer::AllocBufferObject( const void* data, int allocSize, bufferU
else if( usage == BU_DYNAMIC )
{
#if defined(__APPLE__)
// SRS - VMA_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
// SRS - VMA_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vmaReq.usage = VMA_MEMORY_USAGE_CPU_ONLY;
#else
vmaReq.usage = VMA_MEMORY_USAGE_CPU_TO_GPU;
@ -120,12 +120,12 @@ bool idVertexBuffer::AllocBufferObject( const void* data, int allocSize, bufferU
VkResult ret = vkCreateBuffer( vkcontext.device, &bufferCreateInfo, NULL, &apiObject );
assert( ret == VK_SUCCESS );
VkMemoryRequirements memoryRequirements = {};
VkMemoryRequirements memoryRequirements = {};
vkGetBufferMemoryRequirements( vkcontext.device, apiObject, &memoryRequirements );
#if defined(__APPLE__)
// SRS - VULKAN_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_ONLY;
// SRS - VULKAN_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_ONLY;
#else
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_TO_GPU;
#endif
@ -368,7 +368,7 @@ bool idIndexBuffer::AllocBufferObject( const void* data, int allocSize, bufferUs
else if( usage == BU_DYNAMIC )
{
#if defined(__APPLE__)
// SRS - VMA_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
// SRS - VMA_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vmaReq.usage = VMA_MEMORY_USAGE_CPU_ONLY;
#else
vmaReq.usage = VMA_MEMORY_USAGE_CPU_TO_GPU;
@ -382,12 +382,12 @@ bool idIndexBuffer::AllocBufferObject( const void* data, int allocSize, bufferUs
VkResult ret = vkCreateBuffer( vkcontext.device, &bufferCreateInfo, NULL, &apiObject );
assert( ret == VK_SUCCESS );
VkMemoryRequirements memoryRequirements = {};
VkMemoryRequirements memoryRequirements = {};
vkGetBufferMemoryRequirements( vkcontext.device, apiObject, &memoryRequirements );
#if defined(__APPLE__)
// SRS - VULKAN_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_ONLY;
// SRS - VULKAN_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_ONLY;
#else
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_TO_GPU;
#endif
@ -631,7 +631,7 @@ bool idUniformBuffer::AllocBufferObject( const void* data, int allocSize, buffer
else if( usage == BU_DYNAMIC )
{
#if defined(__APPLE__)
// SRS - VMA_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
// SRS - VMA_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vmaReq.usage = VMA_MEMORY_USAGE_CPU_ONLY;
#else
vmaReq.usage = VMA_MEMORY_USAGE_CPU_TO_GPU;
@ -649,8 +649,8 @@ bool idUniformBuffer::AllocBufferObject( const void* data, int allocSize, buffer
vkGetBufferMemoryRequirements( vkcontext.device, apiObject, &memoryRequirements );
#if defined(__APPLE__)
// SRS - VULKAN_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_ONLY;
// SRS - VULKAN_MEMORY_USAGE_CPU_ONLY required for BU_DYNAMIC host coherency on OSX, otherwise black screen
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_ONLY;
#else
vulkanMemoryUsage_t memUsage = ( usage == BU_STATIC ) ? VULKAN_MEMORY_USAGE_GPU_ONLY : VULKAN_MEMORY_USAGE_CPU_TO_GPU;
#endif

View file

@ -267,7 +267,7 @@ void idImage::CreateSampler()
if( r_maxAnisotropicFiltering.GetInteger() > 0 )
{
createInfo.anisotropyEnable = VK_TRUE;
createInfo.maxAnisotropy = Min( r_maxAnisotropicFiltering.GetFloat(), vkcontext.gpu->props.limits.maxSamplerAnisotropy );
createInfo.maxAnisotropy = Min( r_maxAnisotropicFiltering.GetFloat(), vkcontext.gpu->props.limits.maxSamplerAnisotropy );
}
break;
@ -720,20 +720,20 @@ void idImage::SubImageUpload( int mipLevel, int x, int y, int z, int width, int
}
#endif
#if defined(__APPLE__) && defined(USE_BINKDEC)
else if( opts.format == FMT_LUM8 && ( imgName == "_cinematicCr" || imgName == "_cinematicCb" ) )
{
// SRS - When decoding YUV420 cinematics on OSX, copy and duplicate individual rows of half-height chroma planes into full-height planes
// This works around a stall that occurs with half-height planes when exiting levels or after demo playback (possible issue in MoltenVK??)
// ***IMPORTANT - Assumes that SubImageUpload() has been called with half-width and full-height parameters and a packed pic buffer ***
byte* imgData = ( byte* )pic;
int evenRow;
for( int i = 0; i < size / 2; i++ )
{
evenRow = ( i / width ) * 2;
data[ evenRow * width + i % width ] = imgData[ i ]; // SRS - Copy image data into even-numbered rows of new chroma plane
data[ ( evenRow + 1 ) * width + i % width ] = imgData[ i ]; // SRS - Duplicate image data into odd-numbered rows of new chroma plane
}
}
else if( opts.format == FMT_LUM8 && ( imgName == "_cinematicCr" || imgName == "_cinematicCb" ) )
{
// SRS - When decoding YUV420 cinematics on OSX, copy and duplicate individual rows of half-height chroma planes into full-height planes
// This works around a stall that occurs with half-height planes when exiting levels or after demo playback (possible issue in MoltenVK??)
// ***IMPORTANT - Assumes that SubImageUpload() has been called with half-width and full-height parameters and a packed pic buffer ***
byte* imgData = ( byte* )pic;
int evenRow;
for( int i = 0; i < size / 2; i++ )
{
evenRow = ( i / width ) * 2;
data[ evenRow * width + i % width ] = imgData[ i ]; // SRS - Copy image data into even-numbered rows of new chroma plane
data[( evenRow + 1 ) * width + i % width ] = imgData[ i ]; // SRS - Duplicate image data into odd-numbered rows of new chroma plane
}
}
#endif
else
{

View file

@ -283,37 +283,37 @@ static void CreateVulkanInstance()
vkcontext.instanceExtensions.Append( g_instanceExtensions[ i ] );
}
#elif defined(VULKAN_USE_PLATFORM_SDL) // SDL2
auto sdl_instanceExtensions = get_required_extensions();
// SRS - Populate vkcontext with required SDL instance extensions
for( auto instanceExtension : sdl_instanceExtensions )
{
vkcontext.instanceExtensions.Append( instanceExtension );
}
auto sdl_instanceExtensions = get_required_extensions();
// SRS - Populate vkcontext with required SDL instance extensions
for( auto instanceExtension : sdl_instanceExtensions )
{
vkcontext.instanceExtensions.Append( instanceExtension );
}
#endif
// SRS - Enumerate available Vulkan instance extensions and test for presence of VK_KHR_get_physical_device_properties2 and VK_EXT_debug_utils
idLib::Printf( "Getting available vulkan instance extensions...\n" );
uint32 numInstanceExtensions;
ID_VK_CHECK( vkEnumerateInstanceExtensionProperties( NULL, &numInstanceExtensions, NULL ) );
ID_VK_VALIDATE( numInstanceExtensions > 0, "vkEnumerateInstanceExtensionProperties returned zero extensions." );
// SRS - Enumerate available Vulkan instance extensions and test for presence of VK_KHR_get_physical_device_properties2 and VK_EXT_debug_utils
idLib::Printf( "Getting available vulkan instance extensions...\n" );
uint32 numInstanceExtensions;
ID_VK_CHECK( vkEnumerateInstanceExtensionProperties( NULL, &numInstanceExtensions, NULL ) );
ID_VK_VALIDATE( numInstanceExtensions > 0, "vkEnumerateInstanceExtensionProperties returned zero extensions." );
idList< VkExtensionProperties > instanceExtensionProps;
instanceExtensionProps.SetNum( numInstanceExtensions );
ID_VK_CHECK( vkEnumerateInstanceExtensionProperties( NULL, &numInstanceExtensions, instanceExtensionProps.Ptr() ) );
ID_VK_VALIDATE( numInstanceExtensions > 0, "vkEnumerateInstanceExtensionProperties returned zero extensions." );
idList< VkExtensionProperties > instanceExtensionProps;
instanceExtensionProps.SetNum( numInstanceExtensions );
ID_VK_CHECK( vkEnumerateInstanceExtensionProperties( NULL, &numInstanceExtensions, instanceExtensionProps.Ptr() ) );
ID_VK_VALIDATE( numInstanceExtensions > 0, "vkEnumerateInstanceExtensionProperties returned zero extensions." );
vkcontext.deviceProperties2Available = false;
for( int i = 0; i < numInstanceExtensions; i++ )
{
if( idStr::Icmp( instanceExtensionProps[ i ].extensionName, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME ) == 0 )
{
vkcontext.instanceExtensions.AddUnique( VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME );
vkcontext.deviceProperties2Available = true;
break;
}
}
vkcontext.debugUtilsSupportAvailable = false;
vkcontext.deviceProperties2Available = false;
for( int i = 0; i < numInstanceExtensions; i++ )
{
if( idStr::Icmp( instanceExtensionProps[ i ].extensionName, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME ) == 0 )
{
vkcontext.instanceExtensions.AddUnique( VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME );
vkcontext.deviceProperties2Available = true;
break;
}
}
vkcontext.debugUtilsSupportAvailable = false;
if( enableLayers )
{
for( int i = 0; i < g_numDebugInstanceExtensions; ++i )
@ -321,24 +321,24 @@ static void CreateVulkanInstance()
vkcontext.instanceExtensions.Append( g_debugInstanceExtensions[ i ] );
}
idLib::Printf( "Number of available instance extensions\t%i\n", numInstanceExtensions );
idLib::Printf( "Available Extension List: \n" );
for( int i = 0; i < numInstanceExtensions; i++ )
{
idLib::Printf( "\t%s\n", instanceExtensionProps[ i ].extensionName );
if( idStr::Icmp( instanceExtensionProps[ i ].extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME ) == 0 )
{
vkcontext.instanceExtensions.AddUnique( VK_EXT_DEBUG_UTILS_EXTENSION_NAME );
vkcontext.debugUtilsSupportAvailable = true;
}
}
idLib::Printf( "Number of enabled instance extensions\t%i\n", vkcontext.instanceExtensions.Num() );
idLib::Printf( "Enabled Extension List: \n" );
for( int i = 0; i < vkcontext.instanceExtensions.Num(); ++i )
{
idLib::Printf( "\t%s\n", vkcontext.instanceExtensions[ i ] );
}
idLib::Printf( "Number of available instance extensions\t%i\n", numInstanceExtensions );
idLib::Printf( "Available Extension List: \n" );
for( int i = 0; i < numInstanceExtensions; i++ )
{
idLib::Printf( "\t%s\n", instanceExtensionProps[ i ].extensionName );
if( idStr::Icmp( instanceExtensionProps[ i ].extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME ) == 0 )
{
vkcontext.instanceExtensions.AddUnique( VK_EXT_DEBUG_UTILS_EXTENSION_NAME );
vkcontext.debugUtilsSupportAvailable = true;
}
}
idLib::Printf( "Number of enabled instance extensions\t%i\n", vkcontext.instanceExtensions.Num() );
idLib::Printf( "Enabled Extension List: \n" );
for( int i = 0; i < vkcontext.instanceExtensions.Num(); ++i )
{
idLib::Printf( "\t%s\n", vkcontext.instanceExtensions[ i ] );
}
for( int i = 0; i < g_numValidationLayers; ++i )
{
@ -460,10 +460,10 @@ static void EnumeratePhysicalDevices()
idLib::Printf( "Found device[%i] Vendor: AMD\n", i );
break;
// SRS - Added support for Apple GPUs
case 0x106B:
idLib::Printf( "Found device[%i] Vendor: Apple\n", i );
break;
// SRS - Added support for Apple GPUs
case 0x106B:
idLib::Printf( "Found device[%i] Vendor: Apple\n", i );
break;
default:
idLib::Printf( "Found device[%i] Vendor: Unknown (0x%x)\n", i, gpu.props.vendorID );
@ -560,7 +560,7 @@ static void PopulateDeviceExtensions( const idList< VkExtensionProperties >& ext
continue;
}
// SRS - Move this to CreateVulkanInstance(), since VK_EXT_debug_utils is an instance extension not a device extension
// SRS - Move this to CreateVulkanInstance(), since VK_EXT_debug_utils is an instance extension not a device extension
//if( idStr::Icmp( extensionProps[ i ].extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME ) == 0 && enableLayers )
//{
// extensions.AddUnique( VK_EXT_DEBUG_UTILS_EXTENSION_NAME );
@ -610,10 +610,10 @@ static void EnableDeviceExtensionFeatures( const idList< const char* >& extensio
{
idLib::Printf( "Using Vulkan device extension [%s]\n", VK_EXT_DEBUG_MARKER_EXTENSION_NAME );
vkcontext.debugMarkerSupportAvailable = true;
break;
break;
}
// SRS - Move this to CreateVulkanInstance(), since VK_EXT_debug_utils is an instance extension not a device extension
// SRS - Move this to CreateVulkanInstance(), since VK_EXT_debug_utils is an instance extension not a device extension
//if( idStr::Icmp( extensions[ i ], VK_EXT_DEBUG_UTILS_EXTENSION_NAME ) == 0 )
//{
// idLib::Printf( "Using Vulkan device extension [%s]\n", VK_EXT_DEBUG_UTILS_EXTENSION_NAME );
@ -713,63 +713,63 @@ static void SelectPhysicalDevice()
case 0x8086:
idLib::Printf( "Device[%i] : Vendor: Intel\n", i );
glConfig.vendor = VENDOR_INTEL;
glConfig.vendor_string = "Intel Inc.";
glConfig.vendor_string = "Intel Inc.";
break;
case 0x10DE:
idLib::Printf( "Device[%i] : Vendor: NVIDIA\n", i );
glConfig.vendor = VENDOR_NVIDIA;
glConfig.vendor_string = "NVIDIA Corporation";
glConfig.vendor_string = "NVIDIA Corporation";
break;
case 0x1002:
idLib::Printf( "Device[%i] : Vendor: AMD\n", i );
glConfig.vendor = VENDOR_AMD;
glConfig.vendor_string = "ATI Technologies Inc.";
glConfig.vendor_string = "ATI Technologies Inc.";
break;
// SRS - Added support for Apple GPUs
case 0x106B:
idLib::Printf( "Found device[%i] Vendor: Apple\n", i );
glConfig.vendor = VENDOR_APPLE;
glConfig.vendor_string = "Apple";
break;
// SRS - Added support for Apple GPUs
case 0x106B:
idLib::Printf( "Found device[%i] Vendor: Apple\n", i );
glConfig.vendor = VENDOR_APPLE;
glConfig.vendor_string = "Apple";
break;
default:
idLib::Printf( "Device[%i] : Vendor: Unknown (0x%x)\n", i, gpu.props.vendorID );
}
glConfig.renderer_string = gpu.props.deviceName;
static idStr version_string;
version_string.Clear();
version_string.Append( va( "Vulkan API %i.%i.%i", VK_API_VERSION_MAJOR( gpu.props.apiVersion ), VK_API_VERSION_MINOR( gpu.props.apiVersion ), VK_API_VERSION_PATCH( gpu.props.apiVersion ) ) );
glConfig.renderer_string = gpu.props.deviceName;
static idStr extensions_string;
extensions_string.Clear();
bool driverPropertiesAvailable = false;
for( int i = 0; i < gpu.extensionProps.Num(); i++ )
{
extensions_string.Append( va( "%s ", gpu.extensionProps[ i ].extensionName ) );
if( idStr::Icmp( gpu.extensionProps[ i ].extensionName, VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME ) == 0 )
{
driverPropertiesAvailable = true;
}
}
glConfig.extensions_string = extensions_string.c_str();
if( vkcontext.deviceProperties2Available && driverPropertiesAvailable )
{
VkPhysicalDeviceProperties2 pProperties = {};
VkPhysicalDeviceDriverProperties pDriverProperties = {};
pProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
pProperties.pNext = &pDriverProperties;
pDriverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
vkGetPhysicalDeviceProperties2( vkcontext.physicalDevice, &pProperties );
version_string.Append( va( " (%s %s)", pDriverProperties.driverName, pDriverProperties.driverInfo ) );
}
glConfig.version_string = version_string.c_str();
static idStr version_string;
version_string.Clear();
version_string.Append( va( "Vulkan API %i.%i.%i", VK_API_VERSION_MAJOR( gpu.props.apiVersion ), VK_API_VERSION_MINOR( gpu.props.apiVersion ), VK_API_VERSION_PATCH( gpu.props.apiVersion ) ) );
static idStr extensions_string;
extensions_string.Clear();
bool driverPropertiesAvailable = false;
for( int i = 0; i < gpu.extensionProps.Num(); i++ )
{
extensions_string.Append( va( "%s ", gpu.extensionProps[ i ].extensionName ) );
if( idStr::Icmp( gpu.extensionProps[ i ].extensionName, VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME ) == 0 )
{
driverPropertiesAvailable = true;
}
}
glConfig.extensions_string = extensions_string.c_str();
if( vkcontext.deviceProperties2Available && driverPropertiesAvailable )
{
VkPhysicalDeviceProperties2 pProperties = {};
VkPhysicalDeviceDriverProperties pDriverProperties = {};
pProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
pProperties.pNext = &pDriverProperties;
pDriverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
vkGetPhysicalDeviceProperties2( vkcontext.physicalDevice, &pProperties );
version_string.Append( va( " (%s %s)", pDriverProperties.driverName, pDriverProperties.driverInfo ) );
}
glConfig.version_string = version_string.c_str();
return;
}
@ -815,26 +815,26 @@ static void CreateLogicalDeviceAndQueues()
vkGetPhysicalDeviceFeatures2( vkcontext.physicalDevice, &deviceFeatures2 );
#if defined(USE_MoltenVK)
MVKConfiguration pConfig;
size_t pConfigSize = sizeof( pConfig );
MVKConfiguration pConfig;
size_t pConfigSize = sizeof( pConfig );
ID_VK_CHECK( vkGetMoltenVKConfigurationMVK( vkcontext.instance, &pConfig, &pConfigSize ) );
// SRS - If we don't have native image view swizzle, enable MoltenVK's image view swizzle feature
if( portabilityFeatures.imageViewFormatSwizzle == VK_FALSE )
{
idLib::Printf( "Enabling MoltenVK's image view swizzle...\n" );
pConfig.fullImageViewSwizzle = VK_TRUE;
ID_VK_CHECK( vkSetMoltenVKConfigurationMVK( vkcontext.instance, &pConfig, &pConfigSize ) );
}
ID_VK_CHECK( vkGetMoltenVKConfigurationMVK( vkcontext.instance, &pConfig, &pConfigSize ) );
// SRS - If MoltenVK's Metal argument buffer feature is on, disable it for sampler scalability
if( pConfig.useMetalArgumentBuffers == VK_TRUE )
{
idLib::Printf( "Disabling MoltenVK's Metal argument buffers...\n" );
pConfig.useMetalArgumentBuffers = VK_FALSE;
ID_VK_CHECK( vkSetMoltenVKConfigurationMVK( vkcontext.instance, &pConfig, &pConfigSize ) );
}
// SRS - If we don't have native image view swizzle, enable MoltenVK's image view swizzle feature
if( portabilityFeatures.imageViewFormatSwizzle == VK_FALSE )
{
idLib::Printf( "Enabling MoltenVK's image view swizzle...\n" );
pConfig.fullImageViewSwizzle = VK_TRUE;
ID_VK_CHECK( vkSetMoltenVKConfigurationMVK( vkcontext.instance, &pConfig, &pConfigSize ) );
}
// SRS - If MoltenVK's Metal argument buffer feature is on, disable it for sampler scalability
if( pConfig.useMetalArgumentBuffers == VK_TRUE )
{
idLib::Printf( "Disabling MoltenVK's Metal argument buffers...\n" );
pConfig.useMetalArgumentBuffers = VK_FALSE;
ID_VK_CHECK( vkSetMoltenVKConfigurationMVK( vkcontext.instance, &pConfig, &pConfigSize ) );
}
#endif
#else
VkPhysicalDeviceFeatures deviceFeatures = {};
@ -892,7 +892,7 @@ static void CreateLogicalDeviceAndQueues()
if( vkcontext.debugUtilsSupportAvailable )
{
// SRS - Since VK_EXT_debug_utils is an instance extension, must use vkGetInstanceProcAddr() vs vkGetDeviceProcAddr()
// SRS - Since VK_EXT_debug_utils is an instance extension, must use vkGetInstanceProcAddr() vs vkGetDeviceProcAddr()
qvkQueueBeginDebugUtilsLabelEXT = ( PFN_vkQueueBeginDebugUtilsLabelEXT )vkGetInstanceProcAddr( vkcontext.instance, "vkQueueBeginDebugUtilsLabelEXT" );
qvkQueueEndDebugUtilsLabelEXT = ( PFN_vkQueueEndDebugUtilsLabelEXT )vkGetInstanceProcAddr( vkcontext.instance, "vkQueueEndDebugUtilsLabelEXT" );
qvkCmdBeginDebugUtilsLabelEXT = ( PFN_vkCmdBeginDebugUtilsLabelEXT )vkGetInstanceProcAddr( vkcontext.instance, "vkCmdBeginDebugUtilsLabelEXT" );
@ -1513,14 +1513,14 @@ ClearContext
static void ClearContext()
{
#if defined(VULKAN_USE_PLATFORM_SDL)
vkcontext.sdlWindow = nullptr;
vkcontext.sdlWindow = nullptr;
#endif
vkcontext.frameCounter = 0;
vkcontext.frameParity = 0;
vkcontext.jointCacheHandle = 0;
vkcontext.instance = VK_NULL_HANDLE;
vkcontext.physicalDevice = VK_NULL_HANDLE;
vkcontext.physicalDeviceFeatures = {};
vkcontext.physicalDeviceFeatures = {};
vkcontext.device = VK_NULL_HANDLE;
vkcontext.graphicsQueue = VK_NULL_HANDLE;
vkcontext.presentQueue = VK_NULL_HANDLE;
@ -1530,9 +1530,9 @@ static void ClearContext()
vkcontext.instanceExtensions.Clear();
vkcontext.deviceExtensions.Clear();
vkcontext.validationLayers.Clear();
vkcontext.debugMarkerSupportAvailable = false;
vkcontext.debugUtilsSupportAvailable = false;
vkcontext.deviceProperties2Available = false;
vkcontext.debugMarkerSupportAvailable = false;
vkcontext.debugUtilsSupportAvailable = false;
vkcontext.deviceProperties2Available = false;
vkcontext.gpu = NULL;
vkcontext.gpus.Clear();
vkcontext.commandPool = VK_NULL_HANDLE;
@ -1553,10 +1553,10 @@ static void ClearContext()
vkcontext.msaaImage = VK_NULL_HANDLE;
vkcontext.msaaImageView = VK_NULL_HANDLE;
#if defined( USE_AMD_ALLOCATOR )
vkcontext.msaaVmaAllocation = NULL;
vkcontext.msaaAllocation = VmaAllocationInfo();
vkcontext.msaaVmaAllocation = NULL;
vkcontext.msaaAllocation = VmaAllocationInfo();
#else
vkcontext.msaaAllocation = vulkanAllocation_t();
vkcontext.msaaAllocation = vulkanAllocation_t();
#endif
vkcontext.swapchainImages.Zero();
vkcontext.swapchainViews.Zero();
@ -2109,12 +2109,12 @@ void idRenderBackend::GL_StartFrame()
vkGetQueryPoolResults( vkcontext.device, queryPool, MRB_GPU_TIME, numQueries,
results.ByteSize(), results.Ptr(), sizeof( uint64 ), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT );
#if defined(__APPLE__)
// SRS - When using Metal-derived timestamps on OSX, update timestampPeriod every frame based on ongoing calibration within MoltenVK
// Only need to do this for non-Apple GPUs, for Apple GPUs timestampPeriod = 1 and ongoing calibration within MoltenVK is skipped
if( vkcontext.gpu->props.vendorID != 0x106B )
{
vkGetPhysicalDeviceProperties( vkcontext.gpu->device, &vkcontext.gpu->props );
}
// SRS - When using Metal-derived timestamps on OSX, update timestampPeriod every frame based on ongoing calibration within MoltenVK
// Only need to do this for non-Apple GPUs, for Apple GPUs timestampPeriod = 1 and ongoing calibration within MoltenVK is skipped
if( vkcontext.gpu->props.vendorID != 0x106B )
{
vkGetPhysicalDeviceProperties( vkcontext.gpu->device, &vkcontext.gpu->props );
}
#endif
const uint64 gpuStart = results[ assignedIndex[ MRB_GPU_TIME * 2 + 0 ] ];
const uint64 gpuEnd = results[ assignedIndex[ MRB_GPU_TIME * 2 + 1 ] ];

View file

@ -5265,8 +5265,8 @@ VkResult vmaFindMemoryTypeIndex(
if( ( pMemoryRequirements->flags & VMA_MEMORY_REQUIREMENT_PERSISTENT_MAP_BIT ) != 0 )
{
requiredFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoidFlags |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
// SRS - Make sure memory type does not have VK_MEMORY_HEAP_MULTI_INSTANCE_BIT set, otherwise get validation errors when mapping memory
avoidFlags |= VK_MEMORY_HEAP_MULTI_INSTANCE_BIT;
}
*pMemoryTypeIndex = UINT32_MAX;

View file

@ -34,7 +34,7 @@ extern "C"
#endif
#if defined(USE_BINKDEC)
#include <BinkDecoder.h>
#include <BinkDecoder.h>
#endif
extern idCVar s_noSound;
@ -60,7 +60,7 @@ void CinematicAudio_OpenAL::InitAudio( void* audioContext )
#if defined(USE_FFMPEG)
AVCodecContext* dec_ctx2 = ( AVCodecContext* )audioContext;
av_rate_cin = dec_ctx2->sample_rate;
switch( dec_ctx2->sample_fmt )
{
case AV_SAMPLE_FMT_U8:

View file

@ -34,11 +34,11 @@ extern "C"
#endif
#if defined(USE_BINKDEC)
#include <BinkDecoder.h>
#include <BinkDecoder.h>
#endif
CinematicAudio_XAudio2::CinematicAudio_XAudio2():
pMusicSourceVoice1(NULL)
pMusicSourceVoice1( NULL )
{
}
@ -59,7 +59,7 @@ public:
void OnBufferStart( void* pBufferContext ) { }
void OnLoopEnd( void* pBufferContext ) { }
void OnStreamEnd( ) { }
void OnVoiceError( void* pBufferContext, HRESULT Error) { }
void OnVoiceError( void* pBufferContext, HRESULT Error ) { }
void OnVoiceProcessingPassEnd( ) { }
void OnVoiceProcessingPassStart( UINT32 BytesRequired ) { }
};
@ -73,7 +73,7 @@ void CinematicAudio_XAudio2::InitAudio( void* audioContext )
AVCodecContext* dec_ctx2 = ( AVCodecContext* )audioContext;
int format_byte = 0;
bool use_ext = false;
switch( dec_ctx2->sample_fmt )
{
case AV_SAMPLE_FMT_U8:
@ -116,7 +116,7 @@ void CinematicAudio_XAudio2::InitAudio( void* audioContext )
voiceFormatcine.nChannels = binkInfo->nChannels; //fixed
voiceFormatcine.nSamplesPerSec = binkInfo->sampleRate; //fixed
#endif
WAVEFORMATEXTENSIBLE exvoice = { 0 };
voiceFormatcine.wFormatTag = WAVE_FORMAT_EXTENSIBLE; //Use extensible wave format in order to handle properly the audio
voiceFormatcine.wBitsPerSample = format_byte * 8; //fixed

View file

@ -84,8 +84,8 @@ std::vector<const char*> get_required_extensions()
sdlInstanceExtensions.resize( sdlCount );
SDL_Vulkan_GetInstanceExtensions( nullptr, &sdlCount, sdlInstanceExtensions.data() );
// SRS - Report enabled instance extensions in CreateVulkanInstance() vs. doing it here
/*
// SRS - Report enabled instance extensions in CreateVulkanInstance() vs. doing it here
/*
if( enableValidationLayers )
{
idLib::Printf( "\nNumber of availiable instance extensions\t%i\n", sdlCount );
@ -95,7 +95,7 @@ std::vector<const char*> get_required_extensions()
idLib::Printf( "\t%s\n", ext );
}
}
*/
*/
// SRS - needed for MoltenVK portability implementation and optionally for MoltenVK configuration on OSX
#if defined(__APPLE__)
@ -105,8 +105,8 @@ std::vector<const char*> get_required_extensions()
#endif
#endif
// SRS - Add debug instance extensions in CreateVulkanInstance() vs. hardcoding them here
/*
// SRS - Add debug instance extensions in CreateVulkanInstance() vs. hardcoding them here
/*
if( enableValidationLayers )
{
sdlInstanceExtensions.push_back( "VK_EXT_debug_report" );
@ -119,7 +119,7 @@ std::vector<const char*> get_required_extensions()
idLib::Printf( "\t%s\n", ext );
}
}
*/
*/
return sdlInstanceExtensions;
}