Compiling/Linking/Running, but no rendering, there is audio. glConfig as

a temp fix for the surfaces having a width and height of 0 since
renderSystem->getHeight()/getWidth() access
glConfig.nativeResolutionHeight/Width directly.
This commit is contained in:
Eric Womer 2019-12-29 17:05:33 -05:00
parent 528da79001
commit 7145d9b3f1
10 changed files with 50 additions and 29 deletions

View file

@ -328,7 +328,16 @@ if(USE_VULKAN)
add_definitions(-DUSE_VULKAN)
include_directories($ENV{VULKAN_SDK}/Include)
find_package(XCB)
if(NOT XCB_FOUND)
message(FATAL_ERROR "Could not find XCB library!")
else()
message(STATUS ${XCB_LIBRARIES})
endif()
include_directories(${XCB_INCLUDE_DIRS})
if(SPIRV_SHADERC)
add_definitions(-DSPIRV_SHADERC)
@ -343,7 +352,7 @@ if(USE_VULKAN)
# options required by November 2018 release
SET_OPTION(ENABLE_SPVREMAPPER OFF)
SET_OPTION(ENABLE_GLSLANG_BINARIES OFF)
SET_OPTION(ENABLE_GLSLANG_BINARIES ON)
SET_OPTION(ENABLE_HLSL OFF)
SET_OPTION(ENABLE_OPT ON)
SET_OPTION(SPIRV_SKIP_EXECUTABLES ON)
@ -357,7 +366,7 @@ if(USE_VULKAN)
set(GLSLANG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/glslang)
add_subdirectory(${GLSLANG_DIR})
include_directories(${GLSLANG_DIR}/glslang)
include_directories(${GLSLANG_DIR})
endif()
else()
@ -1618,9 +1627,9 @@ else()
set(Vulkan_LIBRARIES
${Vulkan_LIBRARY}
${XCB_LIBRARIES}
glslang
SPIRV
xcb
)
if(ENABLE_GLSLANG_BINARIES)
@ -1719,6 +1728,7 @@ else()
target_link_libraries(RBDoom3BFG
idlib
${Vulkan_LIBRARIES}
${OPENGL_LIBRARIES}
pthread
${RT_LIBRARY}

View file

@ -73,12 +73,14 @@ assert_sizeof( uint64, 8 );
#define MAX_UNSIGNED_TYPE( x ) ( ( ( ( 1U << ( ( sizeof( x ) - 1 ) * 8 ) ) - 1 ) << 8 ) | 255U )
#define MIN_UNSIGNED_TYPE( x ) 0
template< typename _type_ >
bool IsSignedType( const _type_ t )
{
return _type_( -1 ) < 0;
}
#if !defined(USE_AMD_ALLOCATOR)
template<class T> T Max( T x, T y )
{
return ( x > y ) ? x : y;
@ -87,7 +89,7 @@ template<class T> T Min( T x, T y )
{
return ( x < y ) ? x : y;
}
#endif // USE_AMD_ALLOCATOR
class idFile;

View file

@ -438,7 +438,7 @@ void idVulkanBlock::Free( vulkanAllocation_t& allocation )
if( current == NULL )
{
idLib::Warning( "idVulkanBlock::Free: Tried to free an unknown allocation. %p - %lu", this, allocation.id );
idLib::Warning( "idVulkanBlock::Free: Tried to free an unknown allocation. %p - %u", this, allocation.id );
return;
}
@ -492,21 +492,21 @@ void idVulkanBlock::Print()
count++;
}
idLib::Printf( "Type Index: %lu\n", memoryTypeIndex );
idLib::Printf( "Type Index: %u\n", memoryTypeIndex );
idLib::Printf( "Usage: %s\n", memoryUsageStrings[ usage ] );
idLib::Printf( "Count: %d\n", count );
idLib::Printf( "Size: %llu\n", size );
idLib::Printf( "Allocated: %llu\n", allocated );
idLib::Printf( "Next Block: %lu\n", nextBlockId );
idLib::Printf( "Size: %lu\n", size );
idLib::Printf( "Allocated: %lu\n", allocated );
idLib::Printf( "Next Block: %u\n", nextBlockId );
idLib::Printf( "------------------------\n" );
for( chunk_t* current = head; current != NULL; current = current->next )
{
idLib::Printf( "{\n" );
idLib::Printf( "\tId: %lu\n", current->id );
idLib::Printf( "\tSize: %llu\n", current->size );
idLib::Printf( "\tOffset: %llu\n", current->offset );
idLib::Printf( "\tId: %u\n", current->id );
idLib::Printf( "\tSize: %lu\n", current->size );
idLib::Printf( "\tOffset: %lu\n", current->offset );
idLib::Printf( "\tType: %s\n", allocationTypeStrings[ current->type ] );
idLib::Printf( "}\n" );
@ -679,7 +679,7 @@ void idVulkanAllocator::Print()
{
idLib::Printf( "Device Local MB: %d\n", int( deviceLocalMemoryBytes / 1024 * 1024 ) );
idLib::Printf( "Host Visible MB: %d\n", int( hostVisibleMemoryBytes / 1024 * 1024 ) );
idLib::Printf( "Buffer Granularity: %llu\n", bufferImageGranularity );
idLib::Printf( "Buffer Granularity: %lu\n", bufferImageGranularity );
idLib::Printf( "\n" );
for( int i = 0; i < VK_MAX_MEMORY_TYPES; ++i )

View file

@ -439,7 +439,7 @@ static void CreateSurface()
createInfo.connection = info.connection;
createInfo.window = info.window;
ID_VK_CHECK( vkCreateXcbSurfaceKHR( info.inst, &createInfo, NULL, &info.surface ) );
ID_VK_CHECK( vkCreateXcbSurfaceKHR( vkcontext.instance, &createInfo, NULL, &vkcontext.surface ) );
#endif // _WIN32
@ -554,22 +554,22 @@ static void SelectPhysicalDevice()
switch( gpu.props.vendorID )
{
case 0x8086:
idLib::Printf( "Vendor: Intel\n", i );
idLib::Printf( "Vendor: Intel\n");
glConfig.vendor = VENDOR_INTEL;
break;
case 0x10DE:
idLib::Printf( "Vendor: NVIDIA\n", i );
idLib::Printf( "Vendor: NVIDIA\n");
glConfig.vendor = VENDOR_NVIDIA;
break;
case 0x1002:
idLib::Printf( "Vendor: AMD\n", i );
idLib::Printf( "Vendor: AMD\n");
glConfig.vendor = VENDOR_AMD;
break;
default:
idLib::Printf( "Vendor: Unknown (0x%x)\n", i, gpu.props.vendorID );
idLib::Printf( "Vendor: Unknown (0x%x)\n", gpu.props.vendorID );
}
return;
@ -966,7 +966,7 @@ static void CreateRenderTargets()
VK_IMAGE_TILING_OPTIMAL,
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT );
}
idLib::Printf( "renderSystem->GetWidth()/GetHeight() %ix%i\n", renderSystem->GetWidth(), renderSystem->GetHeight() );
idImageOpts depthOptions;
depthOptions.format = FMT_DEPTH;
depthOptions.width = renderSystem->GetWidth();

View file

@ -395,9 +395,10 @@ static int CompileGLSLtoSPIRV( const char* filename, const idStr& dataGLSL, cons
}
#else
#include <glslang/public/ShaderLang.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/Include/ResourceLimits.h>
#include <glslang/SPIRV/GlslangToSpv.h>
#include <SPIRV/GlslangToSpv.h>
//#include <glslang/StandAlone/DirStackFileIncluder.h>
namespace glslang
@ -581,7 +582,7 @@ static int CompileGLSLtoSPIRV( const char* filename, const idStr& dataGLSL, cons
idLib::Printf( "%s\n", shader.getInfoDebugLog() );
}
// All thats left to do now is to convert the programs intermediate representation into SpirV:
// All that<EFBFBD>s left to do now is to convert the program<61>s intermediate representation into SpirV:
std::vector<unsigned int> spirV;
spv::SpvBuildLogger logger;
glslang::SpvOptions spvOptions;

View file

@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
#if defined( USE_VULKAN )
//#define VK_USE_PLATFORM_XLIB_KHR
#define VK_USE_PLATFORM_XCB_KHR
#define USE_AMD_ALLOCATOR

View file

@ -22,16 +22,16 @@
#pragma warning( disable: 4244 ) // warning C4244: conversion from 'double' to 'float', possible loss of data
template<class T> T Max( T x, T y )
template<class T> T VMax( T x, T y )
{
return ( x > y ) ? x : y;
}
template<class T> T Min( T x, T y )
template<class T> T VMin( T x, T y )
{
return ( x < y ) ? x : y;
}
#define VMA_IMPLEMENTATION
#define VMA_MAX( v1, v2 ) Max( (v1), (v2) )
#define VMA_MIN( v1, v2 ) Min( (v1), (v2) )
#define VMA_MAX( v1, v2 ) VMax( (v1), (v2) )
#define VMA_MIN( v1, v2 ) VMin( (v1), (v2) )
#include "vma.h"

View file

@ -1956,6 +1956,7 @@ template<typename T, typename AllocatorT>
class VmaList
{
public:
class const_iterator;
class iterator
{
public:
@ -2031,7 +2032,7 @@ public:
}
friend class VmaList<T, AllocatorT>;
friend class VmaList<T, AllocatorT>:: const_iterator;
friend class VmaList<T, AllocatorT>::const_iterator;
};
class const_iterator

View file

@ -571,6 +571,10 @@ static void createWindow(size_t winWidth, size_t winHeight)
/* 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;
}
#endif
@ -595,7 +599,7 @@ int main( int argc, const char** argv )
/* Create the window if using Vulkan */
xcb_generic_event_t *event;
xcb_client_message_event_t *cm;
createWindow(1920, 1080);
createWindow(1600, 900);
#endif
Posix_EarlyInit( );

View file

@ -35,6 +35,8 @@ If you have questions concerning this license or the applicable additional terms
#include <xcb/xcb.h>
#endif
extern glconfig_t glConfig;
void Posix_QueEvent( sysEventType_t type, int value, int value2, int ptrLength, void* ptr );
const char* Posix_Cwd();