mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 06:34:10 +00:00
Applied Astyle
This commit is contained in:
parent
110996b430
commit
bcb61ce306
12 changed files with 190 additions and 180 deletions
|
@ -148,9 +148,9 @@ struct gpuInfo_t
|
|||
|
||||
struct vulkanContext_t
|
||||
{
|
||||
// Eric: If on linux, use this to pass SDL_Window pointer to the SDL_Vulkan_* methods not in sdl_vkimp.cpp file.
|
||||
// Eric: If on linux, use this to pass SDL_Window pointer to the SDL_Vulkan_* methods not in sdl_vkimp.cpp file.
|
||||
#if defined(__linux__)
|
||||
SDL_Window* sdlWindow = nullptr;
|
||||
SDL_Window* sdlWindow = nullptr;
|
||||
#endif
|
||||
uint64 frameCounter;
|
||||
uint32 frameParity;
|
||||
|
|
|
@ -1193,7 +1193,7 @@ struct glimpParms_t
|
|||
|
||||
#define CLAMP(x, lo, hi) ((x) < (lo) ? (lo) : (x) > (hi) ? (hi) : (x))
|
||||
// Helper function for using SDL2 and Vulkan on Linux.
|
||||
std::vector<const char*> get_required_extensions(const std::vector<const char*>& instanceExtensions, bool enableValidationLayers);
|
||||
std::vector<const char*> get_required_extensions( const std::vector<const char*>& instanceExtensions, bool enableValidationLayers );
|
||||
|
||||
const std::vector<const char*> sdlInstanceExtensions = {};
|
||||
|
||||
|
@ -1220,8 +1220,8 @@ void VKimp_Shutdown();
|
|||
// These are now taken as 16 bit values, so we can take full advantage
|
||||
// of dacs with >8 bits of precision
|
||||
void VKimp_SetGamma( unsigned short red[256],
|
||||
unsigned short green[256],
|
||||
unsigned short blue[256] );
|
||||
unsigned short green[256],
|
||||
unsigned short blue[256] );
|
||||
#else
|
||||
// DG: R_GetModeListForDisplay is called before GLimp_Init(), but SDL needs SDL_Init() first.
|
||||
// So add PreInit for platforms that need it, others can just stub it.
|
||||
|
|
|
@ -414,9 +414,9 @@ void R_SetNewMode( const bool fullInit )
|
|||
{
|
||||
// create the context as well as setting up the window
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
if( VKimp_Init( parms ) )
|
||||
if( VKimp_Init( parms ) )
|
||||
#else
|
||||
if( GLimp_Init( parms ) )
|
||||
if( GLimp_Init( parms ) )
|
||||
#endif
|
||||
{
|
||||
// it worked
|
||||
|
@ -431,7 +431,7 @@ void R_SetNewMode( const bool fullInit )
|
|||
{
|
||||
// just rebuild the window
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
if(VKimp_SetScreenParms( parms ))
|
||||
if( VKimp_SetScreenParms( parms ) )
|
||||
#else
|
||||
if( GLimp_SetScreenParms( parms ) )
|
||||
#endif
|
||||
|
@ -1709,7 +1709,7 @@ void R_SetColorMappings()
|
|||
tr.gammaTable[i] = idMath::ClampInt( 0, 0xFFFF, inf );
|
||||
}
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
VKimp_SetGamma( tr.gammaTable, tr.gammaTable, tr.gammaTable);
|
||||
VKimp_SetGamma( tr.gammaTable, tr.gammaTable, tr.gammaTable );
|
||||
#else
|
||||
GLimp_SetGamma( tr.gammaTable, tr.gammaTable, tr.gammaTable );
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "precompiled.h"
|
||||
|
||||
#if 0 // defined(__linux__)
|
||||
#include "../../sys/posix/posix_public.h"
|
||||
#include "../../sys/posix/posix_public.h"
|
||||
#endif
|
||||
|
||||
#include "../RenderCommon.h"
|
||||
|
@ -56,7 +56,7 @@ static const int g_numInstanceExtensions = 2;
|
|||
static const char* g_instanceExtensions[ g_numInstanceExtensions ] =
|
||||
{
|
||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||
VK_KHR_WIN32_SURFACE_EXTENSION_NAME
|
||||
VK_KHR_WIN32_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -286,8 +286,8 @@ static void CreateVulkanInstance()
|
|||
ValidateValidationLayers();
|
||||
}
|
||||
#if defined(__linux__)
|
||||
auto extensions = get_required_extensions(sdlInstanceExtensions, enableLayers);
|
||||
createInfo.enabledExtensionCount = static_cast<uint32_t>(extensions.size());
|
||||
auto extensions = get_required_extensions( sdlInstanceExtensions, enableLayers );
|
||||
createInfo.enabledExtensionCount = static_cast<uint32_t>( extensions.size() );
|
||||
createInfo.ppEnabledExtensionNames = extensions.data();
|
||||
#else
|
||||
createInfo.enabledExtensionCount = vkcontext.instanceExtensions.Num();
|
||||
|
@ -316,7 +316,7 @@ static void EnumeratePhysicalDevices()
|
|||
ID_VK_CHECK( vkEnumeratePhysicalDevices( vkcontext.instance, &numDevices, NULL ) );
|
||||
ID_VK_VALIDATE( numDevices > 0, "vkEnumeratePhysicalDevices returned zero devices." );
|
||||
|
||||
idLib::Printf("found %u devices\n", numDevices);
|
||||
idLib::Printf( "found %u devices\n", numDevices );
|
||||
|
||||
idList< VkPhysicalDevice > devices;
|
||||
devices.SetNum( numDevices );
|
||||
|
@ -328,15 +328,15 @@ static void EnumeratePhysicalDevices()
|
|||
|
||||
for( uint32 i = 0; i < numDevices; ++i )
|
||||
{
|
||||
idLib::Printf("Iterating over gpu %u\n", i);
|
||||
idLib::Printf( "Iterating over gpu %u\n", i );
|
||||
gpuInfo_t& gpu = vkcontext.gpus[ i ];
|
||||
idLib::Printf("have gpuInfo_t ref at %p\n", &vkcontext.gpus[i]);
|
||||
idLib::Printf( "have gpuInfo_t ref at %p\n", &vkcontext.gpus[i] );
|
||||
gpu.device = devices[ i ];
|
||||
idLib::Printf("set gpu.device\n");
|
||||
idLib::Printf( "set gpu.device\n" );
|
||||
|
||||
// get Queue family properties
|
||||
{
|
||||
idLib::Printf("Getting queue family props...\n");
|
||||
idLib::Printf( "Getting queue family props...\n" );
|
||||
uint32 numQueues = 0;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties( gpu.device, &numQueues, NULL );
|
||||
ID_VK_VALIDATE( numQueues > 0, "vkGetPhysicalDeviceQueueFamilyProperties returned zero queues." );
|
||||
|
@ -348,7 +348,7 @@ static void EnumeratePhysicalDevices()
|
|||
|
||||
// grab available Vulkan extensions
|
||||
{
|
||||
idLib::Printf("Getting available vulkan extensions...\n");
|
||||
idLib::Printf( "Getting available vulkan extensions...\n" );
|
||||
uint32 numExtension;
|
||||
ID_VK_CHECK( vkEnumerateDeviceExtensionProperties( gpu.device, NULL, &numExtension, NULL ) );
|
||||
ID_VK_VALIDATE( numExtension > 0, "vkEnumerateDeviceExtensionProperties returned zero extensions." );
|
||||
|
@ -440,14 +440,15 @@ static void CreateSurface()
|
|||
|
||||
#else
|
||||
#if defined(__linux__)
|
||||
if(!SDL_Vulkan_CreateSurface(vkcontext.sdlWindow, vkcontext.instance, &vkcontext.surface)) {
|
||||
idLib::FatalError("Error while creating Vulkan surface: %s", SDL_GetError());
|
||||
}
|
||||
if( !SDL_Vulkan_CreateSurface( vkcontext.sdlWindow, vkcontext.instance, &vkcontext.surface ) )
|
||||
{
|
||||
idLib::FatalError( "Error while creating Vulkan surface: %s", SDL_GetError() );
|
||||
}
|
||||
#else
|
||||
VkXcbSurfaceCreateInfoKHR createInfo = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
createInfo.pNext = NULL;
|
||||
createInfo.flags = 0;
|
||||
createInfo.flags = 0;
|
||||
createInfo.connection = info.connection;
|
||||
createInfo.window = info.window;
|
||||
|
||||
|
@ -566,17 +567,17 @@ static void SelectPhysicalDevice()
|
|||
switch( gpu.props.vendorID )
|
||||
{
|
||||
case 0x8086:
|
||||
idLib::Printf( "Device[%i] : Vendor: Intel \n", i);
|
||||
idLib::Printf( "Device[%i] : Vendor: Intel \n", i );
|
||||
glConfig.vendor = VENDOR_INTEL;
|
||||
break;
|
||||
|
||||
case 0x10DE:
|
||||
idLib::Printf( "Device[%i] : Vendor: NVIDIA\n", i);
|
||||
idLib::Printf( "Device[%i] : Vendor: NVIDIA\n", i );
|
||||
glConfig.vendor = VENDOR_NVIDIA;
|
||||
break;
|
||||
|
||||
case 0x1002:
|
||||
idLib::Printf( "Device[%i] : Vendor: AMD\n", i);
|
||||
idLib::Printf( "Device[%i] : Vendor: AMD\n", i );
|
||||
glConfig.vendor = VENDOR_AMD;
|
||||
break;
|
||||
|
||||
|
@ -722,20 +723,20 @@ static VkExtent2D ChooseSurfaceExtent( VkSurfaceCapabilitiesKHR& caps )
|
|||
{
|
||||
VkExtent2D extent;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
SDL_Vulkan_GetDrawableSize(vkcontext.sdlWindow, &width, &height);
|
||||
width = CLAMP(width, caps.minImageExtent.width, caps.maxImageExtent.width);
|
||||
height = CLAMP(height, caps.minImageExtent.height, caps.maxImageExtent.height);
|
||||
int width;
|
||||
int height;
|
||||
SDL_Vulkan_GetDrawableSize( vkcontext.sdlWindow, &width, &height );
|
||||
width = CLAMP( width, caps.minImageExtent.width, caps.maxImageExtent.width );
|
||||
height = CLAMP( height, caps.minImageExtent.height, caps.maxImageExtent.height );
|
||||
|
||||
if( caps.currentExtent.width == -1 )
|
||||
if( caps.currentExtent.width == -1 )
|
||||
{
|
||||
extent.width = width;
|
||||
extent.height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
extent = caps.currentExtent;
|
||||
extent = caps.currentExtent;
|
||||
}
|
||||
|
||||
return extent;
|
||||
|
@ -826,7 +827,7 @@ DestroySwapChain
|
|||
static void DestroySwapChain()
|
||||
{
|
||||
|
||||
for( uint32 i = 0; i < NUM_FRAME_DATA; ++i )
|
||||
for( uint32 i = 0; i < NUM_FRAME_DATA; ++i )
|
||||
{
|
||||
vkDestroyImageView( vkcontext.device, vkcontext.swapchainViews[ i ], NULL );
|
||||
}
|
||||
|
@ -985,18 +986,18 @@ static void CreateRenderTargets()
|
|||
VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT );
|
||||
}
|
||||
idImageOpts depthOptions;
|
||||
depthOptions.format = FMT_DEPTH;
|
||||
idImageOpts depthOptions;
|
||||
depthOptions.format = FMT_DEPTH;
|
||||
|
||||
// Eric: See if this fixes resizing
|
||||
// Eric: See if this fixes resizing
|
||||
#if defined(__linux__)
|
||||
gpuInfo_t& gpu = *vkcontext.gpu;
|
||||
VkExtent2D extent = ChooseSurfaceExtent( gpu.surfaceCaps );
|
||||
gpuInfo_t& gpu = *vkcontext.gpu;
|
||||
VkExtent2D extent = ChooseSurfaceExtent( gpu.surfaceCaps );
|
||||
|
||||
depthOptions.width = extent.width;
|
||||
depthOptions.height = extent.height;
|
||||
depthOptions.width = extent.width;
|
||||
depthOptions.height = extent.height;
|
||||
#else
|
||||
depthOptions.width = renderSystem->GetWidth();
|
||||
depthOptions.width = renderSystem->GetWidth();
|
||||
depthOptions.height = renderSystem->GetHeight();
|
||||
#endif
|
||||
|
||||
|
@ -1304,12 +1305,12 @@ void idRenderBackend::Init()
|
|||
idLib::FatalError( "R_InitVulkan called while active" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// DG: make sure SDL has setup video so getting supported modes in R_SetNewMode() works
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
VKimp_PreInit();
|
||||
VKimp_PreInit();
|
||||
#else
|
||||
GLimp_PreInit();
|
||||
GLimp_PreInit();
|
||||
#endif
|
||||
// DG end
|
||||
|
||||
|
@ -1482,7 +1483,7 @@ void idRenderBackend::Shutdown()
|
|||
|
||||
// destroy main window
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
VKimp_Shutdown();
|
||||
VKimp_Shutdown();
|
||||
#else
|
||||
GLimp_Shutdown();
|
||||
#endif
|
||||
|
@ -1747,23 +1748,24 @@ idRenderBackend::GL_StartFrame
|
|||
*/
|
||||
void idRenderBackend::GL_StartFrame()
|
||||
{
|
||||
// Eric: Since VK_SUBOPTIMAL_KHR is not a hard fault and VK_ERROR_OUT_OF_DATE_KHR means the window is being resized (or other stuff) handle them instead of killing the app.
|
||||
VkResult result = vkAcquireNextImageKHR( vkcontext.device, vkcontext.swapchain, UINT64_MAX, vkcontext.acquireSemaphores[ vkcontext.frameParity ], VK_NULL_HANDLE, &vkcontext.currentSwapIndex );
|
||||
switch (result) {
|
||||
case VK_SUCCESS:
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
break;
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
DestroySwapChain();
|
||||
CreateSwapChain();
|
||||
return;
|
||||
// return on_window_size_changed();
|
||||
break;
|
||||
default:
|
||||
idLib::FatalError("VK: %s - %s", VK_ErrorToString(result),
|
||||
"vkAcquireNextImageKHR( vkcontext.device, vkcontext.swapchain, UINT64_MAX, vkcontext.acquireSemaphores[ vkcontext.frameParity ], VK_NULL_HANDLE, &vkcontext.currentSwapIndex )");
|
||||
return;
|
||||
}
|
||||
// Eric: Since VK_SUBOPTIMAL_KHR is not a hard fault and VK_ERROR_OUT_OF_DATE_KHR means the window is being resized (or other stuff) handle them instead of killing the app.
|
||||
VkResult result = vkAcquireNextImageKHR( vkcontext.device, vkcontext.swapchain, UINT64_MAX, vkcontext.acquireSemaphores[ vkcontext.frameParity ], VK_NULL_HANDLE, &vkcontext.currentSwapIndex );
|
||||
switch( result )
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
break;
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
DestroySwapChain();
|
||||
CreateSwapChain();
|
||||
return;
|
||||
// return on_window_size_changed();
|
||||
break;
|
||||
default:
|
||||
idLib::FatalError( "VK: %s - %s", VK_ErrorToString( result ),
|
||||
"vkAcquireNextImageKHR( vkcontext.device, vkcontext.swapchain, UINT64_MAX, vkcontext.acquireSemaphores[ vkcontext.frameParity ], VK_NULL_HANDLE, &vkcontext.currentSwapIndex )" );
|
||||
return;
|
||||
}
|
||||
// ID_VK_CHECK( vkAcquireNextImageKHR( vkcontext.device, vkcontext.swapchain, UINT64_MAX, vkcontext.acquireSemaphores[ vkcontext.frameParity ], VK_NULL_HANDLE, &vkcontext.currentSwapIndex ) );
|
||||
|
||||
idImage::EmptyGarbage();
|
||||
|
@ -1887,22 +1889,23 @@ void idRenderBackend::GL_BlockingSwapBuffers()
|
|||
|
||||
// Eric: // Eric: Since VK_SUBOPTIMAL_KHR and VK_ERROR_OUT_OF_DATE_KHR here means
|
||||
// the window is being resized (or other stuff) handle them instead of killing the app.
|
||||
VkResult result = vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo );
|
||||
switch (result) {
|
||||
case VK_SUCCESS:
|
||||
break;
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
// return on_window_size_changed(); Eric: Handle resizing the window.
|
||||
DestroySwapChain();
|
||||
CreateSwapChain();
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
idLib::FatalError("VK: %s - %s", VK_ErrorToString(result),
|
||||
"vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo )");
|
||||
return;
|
||||
}
|
||||
VkResult result = vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo );
|
||||
switch( result )
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
break;
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
// return on_window_size_changed(); Eric: Handle resizing the window.
|
||||
DestroySwapChain();
|
||||
CreateSwapChain();
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
idLib::FatalError( "VK: %s - %s", VK_ErrorToString( result ),
|
||||
"vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo )" );
|
||||
return;
|
||||
}
|
||||
|
||||
// ID_VK_CHECK( vkQueuePresentKHR( vkcontext.presentQueue, &presentInfo ) );
|
||||
|
||||
|
|
|
@ -33,17 +33,17 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#if defined( USE_VULKAN )
|
||||
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
#include <Windows.h>
|
||||
#include <Windows.h>
|
||||
#elif defined(VK_USE_PLATFORM_XCB_KHR)
|
||||
#include <xcb/xcb.h>
|
||||
#include <dlfcn.h>
|
||||
#include <cstdlib>
|
||||
#include <xcb/xcb.h>
|
||||
#include <dlfcn.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <dlfcn.h>
|
||||
#include <cstdlib>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <dlfcn.h>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#define USE_AMD_ALLOCATOR
|
||||
|
@ -51,8 +51,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <vulkan/vulkan.h>
|
||||
|
||||
#if defined(VK_USE_PLATFORM_XCB_KHR)
|
||||
#include <xcb/xcb.h>
|
||||
#include <dlfcn.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#if defined( USE_AMD_ALLOCATOR )
|
||||
|
|
|
@ -1956,7 +1956,7 @@ template<typename T, typename AllocatorT>
|
|||
class VmaList
|
||||
{
|
||||
public:
|
||||
class const_iterator;
|
||||
class const_iterator;
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -50,7 +50,7 @@ static int cmdargc = 0;
|
|||
#endif
|
||||
|
||||
#if 0 // defined(USE_VULKAN)
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -523,57 +523,59 @@ void Sys_ReLaunch()
|
|||
/* Declare the global posixInfo */
|
||||
posixInfo info;
|
||||
|
||||
static void createWindow(size_t winWidth, size_t winHeight)
|
||||
static void createWindow( size_t winWidth, size_t winHeight )
|
||||
{
|
||||
/* establish the connection with DISPLAYNAME as NULL,
|
||||
* this will leverage the DISPLAY env var */
|
||||
int screenp = 0; /* which "screen" to use */
|
||||
info.connection = xcb_connect(NULL, &screenp);
|
||||
/* establish the connection with DISPLAYNAME as NULL,
|
||||
* this will leverage the DISPLAY env var */
|
||||
int screenp = 0; /* which "screen" to use */
|
||||
info.connection = xcb_connect( NULL, &screenp );
|
||||
|
||||
/* Check for errors */
|
||||
int xcbErr = xcb_connection_has_error(info.connection);
|
||||
/* Check for errors */
|
||||
int xcbErr = xcb_connection_has_error( info.connection );
|
||||
|
||||
if (xcbErr) {
|
||||
common->Printf("Failed to connect to X server using XCB.");
|
||||
exit(-1);
|
||||
}
|
||||
if( xcbErr )
|
||||
{
|
||||
common->Printf( "Failed to connect to X server using XCB." );
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
/* Setup the window, iterating through screens */
|
||||
const struct xcb_setup_t *xcbSetup = NULL;
|
||||
xcbSetup = xcb_get_setup(info.connection);
|
||||
/* Setup the window, iterating through screens */
|
||||
const struct xcb_setup_t* xcbSetup = NULL;
|
||||
xcbSetup = xcb_get_setup( info.connection );
|
||||
|
||||
xcb_screen_iterator_t scrIter = xcb_setup_roots_iterator(xcbSetup);
|
||||
xcb_screen_iterator_t scrIter = xcb_setup_roots_iterator( xcbSetup );
|
||||
|
||||
for (int screen = screenp; screen > 0; --screen) {
|
||||
xcb_screen_next(&scrIter);
|
||||
}
|
||||
for( int screen = screenp; screen > 0; --screen )
|
||||
{
|
||||
xcb_screen_next( &scrIter );
|
||||
}
|
||||
|
||||
info.screen = scrIter.data;
|
||||
info.screen = scrIter.data;
|
||||
|
||||
/* Now generate the xid used for our window */
|
||||
info.window = xcb_generate_id(info.connection);
|
||||
/* Now generate the xid used for our window */
|
||||
info.window = xcb_generate_id( info.connection );
|
||||
|
||||
/* Register events, creating background pixel */
|
||||
uint32_t eventMask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
|
||||
uint32_t valueList[] = { info.screen->black_pixel, 0 };
|
||||
/* Register events, creating background pixel */
|
||||
uint32_t eventMask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
|
||||
uint32_t valueList[] = { info.screen->black_pixel, 0 };
|
||||
|
||||
/* Create the window, finally */
|
||||
xcb_create_window(info.connection, XCB_COPY_FROM_PARENT, info.window,
|
||||
info.screen->root, 0, 0, winWidth, winHeight, 0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, info.screen->root_visual,
|
||||
eventMask, valueList);
|
||||
/* Create the window, finally */
|
||||
xcb_create_window( info.connection, XCB_COPY_FROM_PARENT, info.window,
|
||||
info.screen->root, 0, 0, winWidth, winHeight, 0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, info.screen->root_visual,
|
||||
eventMask, valueList );
|
||||
|
||||
/* Set some properties, such as the window name, maybe? */
|
||||
xcb_change_property(info.connection, XCB_PROP_MODE_REPLACE,
|
||||
info.window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING,
|
||||
8, 7, "vkRBDoom3BFG");
|
||||
/* Set some properties, such as the window name, maybe? */
|
||||
xcb_change_property( info.connection, XCB_PROP_MODE_REPLACE,
|
||||
info.window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING,
|
||||
8, 7, "vkRBDoom3BFG" );
|
||||
|
||||
/* map the window to the screen and flush the stream to the server */
|
||||
xcb_map_window(info.connection, info.window);
|
||||
xcb_flush(info.connection);
|
||||
/* map the window to the screen and flush the stream to the server */
|
||||
xcb_map_window( info.connection, info.window );
|
||||
xcb_flush( info.connection );
|
||||
|
||||
glConfig.nativeScreenWidth = winWidth;
|
||||
glConfig.nativeScreenHeight = winHeight;
|
||||
glConfig.nativeScreenWidth = winWidth;
|
||||
glConfig.nativeScreenHeight = winHeight;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -596,10 +598,10 @@ int main( int argc, const char** argv )
|
|||
#endif
|
||||
|
||||
#if 0 // defined(USE_VULKAN)
|
||||
/* Create the window if using Vulkan */
|
||||
xcb_generic_event_t *event;
|
||||
xcb_client_message_event_t *cm;
|
||||
createWindow(1280, 720);
|
||||
/* Create the window if using Vulkan */
|
||||
xcb_generic_event_t* event;
|
||||
xcb_client_message_event_t* cm;
|
||||
createWindow( 1280, 720 );
|
||||
#endif
|
||||
|
||||
Posix_EarlyInit( );
|
||||
|
@ -619,11 +621,11 @@ int main( int argc, const char** argv )
|
|||
while( 1 )
|
||||
{
|
||||
#if 0 //defined(USE_VULKAN)
|
||||
/* I'm not 100% sure if intercepting these xcb events interferes with
|
||||
* SDL's input handling or not, but I suspect that it's necessary
|
||||
* to pump some event loop. We'll see */
|
||||
/*event = xcb_wait_for_event(info.connection);
|
||||
free(event); */
|
||||
/* I'm not 100% sure if intercepting these xcb events interferes with
|
||||
* SDL's input handling or not, but I suspect that it's necessary
|
||||
* to pump some event loop. We'll see */
|
||||
/*event = xcb_wait_for_event(info.connection);
|
||||
free(event); */
|
||||
#endif
|
||||
common->Frame();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include <signal.h>
|
||||
|
||||
#ifdef USE_VULKAN
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb.h>
|
||||
#endif
|
||||
|
||||
extern glconfig_t glConfig;
|
||||
|
@ -75,15 +75,16 @@ int clock_gettime( clk_id_t clock, struct timespec* tp );
|
|||
// Eric: Not used on Linux since using SDL2
|
||||
#if 0 //defined(USE_VULKAN)
|
||||
/* Struct that holds global xcb state for vulkan */
|
||||
typedef struct _posixInfo {
|
||||
xcb_connection_t *connection;
|
||||
xcb_window_t window;
|
||||
xcb_screen_t *screen;
|
||||
xcb_atom_t wmProtocols;
|
||||
xcb_atom_t wmDeleteWin;
|
||||
typedef struct _posixInfo
|
||||
{
|
||||
xcb_connection_t* connection;
|
||||
xcb_window_t window;
|
||||
xcb_screen_t* screen;
|
||||
xcb_atom_t wmProtocols;
|
||||
xcb_atom_t wmDeleteWin;
|
||||
} posixInfo;
|
||||
|
||||
extern posixInfo info;
|
||||
extern posixInfo info;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -853,9 +853,9 @@ void Sys_GrabMouseCursor( bool grabIt )
|
|||
flags = GRAB_SETSTATE;
|
||||
}
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
VKimp_GrabInput( flags );
|
||||
VKimp_GrabInput( flags );
|
||||
#else
|
||||
GLimp_GrabInput( flags );
|
||||
GLimp_GrabInput( flags );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -101,9 +101,9 @@ GLimp_Init
|
|||
*/
|
||||
bool GLimp_Init( glimpParms_t parms )
|
||||
{
|
||||
#ifdef USE_VULKAN
|
||||
return true;
|
||||
#endif
|
||||
#ifdef USE_VULKAN
|
||||
return true;
|
||||
#endif
|
||||
|
||||
common->Printf( "Initializing OpenGL subsystem\n" );
|
||||
|
||||
|
@ -485,7 +485,7 @@ GLimp_SetScreenParms
|
|||
bool GLimp_SetScreenParms( glimpParms_t parms )
|
||||
{
|
||||
#ifdef USE_VULKAN
|
||||
return true;
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
|
@ -567,7 +567,7 @@ void GLimp_Shutdown()
|
|||
{
|
||||
#ifdef USE_VULKAN
|
||||
common->Printf( "Shutting down Vulkan subsystem\n" );
|
||||
return;
|
||||
return;
|
||||
#else
|
||||
common->Printf( "Shutting down OpenGL subsystem\n" );
|
||||
#endif
|
||||
|
|
|
@ -36,9 +36,9 @@ const int GRAB_HIDECURSOR = ( 1 << 2 );
|
|||
const int GRAB_SETSTATE = ( 1 << 3 );
|
||||
|
||||
#if defined(__linux__) && defined(USE_VULKAN)
|
||||
void VKimp_GrabInput( int flags);
|
||||
void VKimp_GrabInput( int flags );
|
||||
#else
|
||||
void GLimp_GrabInput( int flags );
|
||||
void GLimp_GrabInput( int flags );
|
||||
#endif
|
||||
char* Sys_ConsoleInput();
|
||||
|
||||
|
|
|
@ -71,35 +71,39 @@ static SDL_Window* window = nullptr;
|
|||
|
||||
// Eric: Integrate this into RBDoom3BFG's source code ecosystem.
|
||||
// Helper function for using SDL2 and Vulkan on Linux.
|
||||
std::vector<const char*> get_required_extensions(const std::vector<const char*>& instanceExtensions, bool enableValidationLayers)
|
||||
std::vector<const char*> get_required_extensions( const std::vector<const char*>& instanceExtensions, bool enableValidationLayers )
|
||||
{
|
||||
uint32_t sdlCount = 0;
|
||||
std::vector<const char*> sdlInstanceExtensions;
|
||||
uint32_t sdlCount = 0;
|
||||
std::vector<const char*> sdlInstanceExtensions;
|
||||
|
||||
SDL_Vulkan_GetInstanceExtensions(nullptr, &sdlCount, nullptr);
|
||||
sdlInstanceExtensions.resize(sdlCount);
|
||||
SDL_Vulkan_GetInstanceExtensions(nullptr, &sdlCount, sdlInstanceExtensions.data());
|
||||
SDL_Vulkan_GetInstanceExtensions( nullptr, &sdlCount, nullptr );
|
||||
sdlInstanceExtensions.resize( sdlCount );
|
||||
SDL_Vulkan_GetInstanceExtensions( nullptr, &sdlCount, sdlInstanceExtensions.data() );
|
||||
|
||||
if (enableValidationLayers) {
|
||||
idLib::Printf("\nNumber of availiable instance extensions\t%i\n", sdlCount);
|
||||
idLib::Printf( "Available Extension List: \n");
|
||||
for (auto ext : sdlInstanceExtensions) {
|
||||
idLib::Printf( "\t%s\n", ext);
|
||||
}
|
||||
}
|
||||
if( enableValidationLayers )
|
||||
{
|
||||
idLib::Printf( "\nNumber of availiable instance extensions\t%i\n", sdlCount );
|
||||
idLib::Printf( "Available Extension List: \n" );
|
||||
for( auto ext : sdlInstanceExtensions )
|
||||
{
|
||||
idLib::Printf( "\t%s\n", ext );
|
||||
}
|
||||
}
|
||||
|
||||
if (enableValidationLayers) {
|
||||
sdlInstanceExtensions.push_back("VK_EXT_debug_report");
|
||||
sdlInstanceExtensions.push_back("VK_EXT_debug_utils");
|
||||
if( enableValidationLayers )
|
||||
{
|
||||
sdlInstanceExtensions.push_back( "VK_EXT_debug_report" );
|
||||
sdlInstanceExtensions.push_back( "VK_EXT_debug_utils" );
|
||||
|
||||
idLib::Printf("Number of active instance extensions\t%zu\n",sdlInstanceExtensions.size());
|
||||
idLib::Printf( "Active Extension List: \n");
|
||||
for (auto const& ext : sdlInstanceExtensions) {
|
||||
idLib::Printf("\t%s\n",ext);
|
||||
}
|
||||
}
|
||||
idLib::Printf( "Number of active instance extensions\t%zu\n", sdlInstanceExtensions.size() );
|
||||
idLib::Printf( "Active Extension List: \n" );
|
||||
for( auto const& ext : sdlInstanceExtensions )
|
||||
{
|
||||
idLib::Printf( "\t%s\n", ext );
|
||||
}
|
||||
}
|
||||
|
||||
return sdlInstanceExtensions;
|
||||
return sdlInstanceExtensions;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -133,7 +137,7 @@ bool VKimp_Init( glimpParms_t parms )
|
|||
|
||||
common->Printf( "Initializing Vulkan subsystem\n" );
|
||||
|
||||
VKimp_PreInit(); // DG: make sure SDL is initialized
|
||||
VKimp_PreInit(); // DG: make sure SDL is initialized
|
||||
|
||||
// DG: make window resizable
|
||||
Uint32 flags = SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE;
|
||||
|
@ -458,7 +462,7 @@ VKimp_Shutdown
|
|||
*/
|
||||
void VKimp_Shutdown()
|
||||
{
|
||||
common->Printf( "Shutting down Vulkan subsystem\n" );
|
||||
common->Printf( "Shutting down Vulkan subsystem\n" );
|
||||
|
||||
if( window )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue