Merge branch 'master' into 635-nvrhi3

This commit is contained in:
Robert Beckebans 2022-10-20 17:08:08 +02:00
commit ddb2be02ff
10 changed files with 103 additions and 76 deletions

2
doomclassic/doom/f_finale.cpp Normal file → Executable file
View file

@ -830,7 +830,7 @@ void F_BunnyScroll( void )
int x;
patch_t* p1;
patch_t* p2;
const size_t name_len = 10;
const size_t name_len = 14;
char name[name_len];
int stage;

2
doomclassic/doom/hu_stuff.cpp Normal file → Executable file
View file

@ -319,7 +319,7 @@ void HU_Init( void )
int i;
int j;
const size_t buffer_len = 9;
const size_t buffer_len = 17;
char buffer[buffer_len];
shiftxform = english_shiftxform;

View file

@ -1909,7 +1909,7 @@ else()
if(USE_PRECOMPILED_HEADERS)
set(RBDOOM3_PRECOMPILED_SOURCES ${RBDOOM3_SOURCES})
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${TIMIDITY_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${ZLIB_SOURCES} ${GLEW_SOURCES} ${BINKDEC_SOURCES} ${IMGUI_SOURCES} ${MIKKTSPACE_SOURCES})
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${TIMIDITY_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${ZLIB_SOURCES} ${GLEW_SOURCES} ${BINKDEC_SOURCES} ${IMGUI_SOURCES} ${MIKKTSPACE_SOURCES} ${OGGVORBIS_SOURCES})
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/libs/zlib/minizip/ioapi.c)
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/DXT/DXTDecoder.cpp)
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/DXT/DXTEncoder.cpp)

View file

@ -167,6 +167,7 @@ struct MemInfo_t
struct mpMap_t
{
mpMap_t& operator=( mpMap_t&& src ) = default;
void operator=( const mpMap_t& src )
{

View file

@ -130,6 +130,7 @@ class idStr
public:
idStr();
idStr( idStr&& text ) noexcept; // Admer: added move constructor
idStr( const idStr& text );
idStr( const idStr& text, int start, int end );
idStr( const char* text );
@ -149,6 +150,7 @@ public:
char operator[]( int index ) const;
char& operator[]( int index );
void operator=( idStr&& text ) noexcept; // Admer: added move operator
void operator=( const idStr& text );
void operator=( const char* text );
@ -477,6 +479,12 @@ ID_INLINE idStr::idStr()
Construct();
}
ID_INLINE idStr::idStr( idStr&& text ) noexcept
{
Construct();
*this = std::move( text );
}
ID_INLINE idStr::idStr( const idStr& text )
{
Construct();
@ -677,6 +685,28 @@ ID_INLINE char& idStr::operator[]( int index )
return data[ index ];
}
ID_INLINE void idStr::operator=( idStr&& text ) noexcept
{
Clear();
len = text.len;
allocedAndFlag = text.allocedAndFlag;
memcpy( baseBuffer, text.baseBuffer, sizeof( baseBuffer ) );
if( text.data == text.baseBuffer )
{
data = baseBuffer;
}
else
{
data = text.data;
}
text.len = 0;
text.allocedAndFlag = 0;
text.data = nullptr;
}
ID_INLINE void idStr::operator=( const idStr& text )
{
int l;

View file

@ -32,6 +32,7 @@ If you have questions concerning this license or the applicable additional terms
#include <new>
#include <initializer_list>
#include <algorithm> // SRS - Needed for clang 14 so std::copy() is defined
/*
===============================================================================
@ -98,7 +99,8 @@ ID_INLINE void* idListArrayResize( void* voldptr, int oldNum, int newNum, bool z
int overlap = Min( oldNum, newNum );
for( int i = 0; i < overlap; i++ )
{
newptr[i] = oldptr[i];
//newptr[i] = oldptr[i];
newptr[i] = std::move( oldptr[i] );
}
}
idListArrayDelete<_type_>( voldptr, oldNum );
@ -125,6 +127,7 @@ public:
typedef _type_ new_t();
idList( int newgranularity = 16 );
idList( idList&& other );
idList( const idList& other );
idList( std::initializer_list<_type_> initializerList );
~idList();
@ -139,6 +142,7 @@ public:
size_t Size() const; // returns total size of allocated memory including size of list _type_
size_t MemoryUsed() const; // returns size of the used elements in the list
idList<_type_, _tag_>& operator=( idList<_type_, _tag_>&& other );
idList<_type_, _tag_>& operator=( const idList<_type_, _tag_>& other );
const _type_& operator[]( int index ) const;
_type_& operator[]( int index );
@ -303,6 +307,18 @@ ID_INLINE idList<_type_, _tag_>::idList( int newgranularity )
Clear();
}
/*
================
idList<_type_,_tag_>::idList( idList< _type_, _tag_ >&& other )
================
*/
template< typename _type_, memTag_t _tag_ >
ID_INLINE idList<_type_, _tag_>::idList( idList&& other )
{
list = NULL;
*this = std::move( other );
}
/*
================
idList<_type_,_tag_>::idList( const idList< _type_, _tag_ > &other )
@ -700,6 +716,30 @@ ID_INLINE void idList<_type_, _tag_>::AssureSizeAlloc( int newSize, new_t* alloc
================
idList<_type_,_tag_>::operator=
Moves the contents and size attributes of another list, effectively emptying the other list.
================
*/
template< typename _type_, memTag_t _tag_ >
ID_INLINE idList<_type_, _tag_>& idList<_type_, _tag_>::operator=( idList<_type_, _tag_>&& other )
{
Clear();
num = other.num;
size = other.size;
granularity = other.granularity;
memTag = other.memTag;
list = other.list;
other.list = nullptr;
other.Clear();
return *this;
}
/*
================
idList<_type_,_tag_>::operator=
Copies the contents and size attributes of another list.
================
*/

View file

@ -523,6 +523,7 @@ idList<idJointQuat> GetPose( idList<gltfNode>& bones, idJointMat* poseMat )
if( node->parent == nullptr )
{
node->matrix *= blenderToDoomTransform;
trans = node->matrix;
}
idJointQuat& pose = ret[i];
@ -720,24 +721,6 @@ idFile_Memory* idRenderModelGLTF::GetAnimBin( idStr animName , const ID_TIME_T
baseFrame.SetGranularity( 1 );
baseFrame.SetNum( bones.Num() );
gltfSkin* skin = data->GetSkin( gltfAnim );;
gltfAccessor* acc = nullptr;
if( skin != nullptr )
{
acc = data->AccessorList()[skin->inverseBindMatrices];
}
else
{
skin = new gltfSkin;
skin->joints.AssureSize( 1, data->GetNodeIndex( root ) );
idMat4 trans = mat4_identity;
data->ResolveNodeMatrix( root, &trans );
trans *= blenderToDoomTransform.Inverse();
acc = new gltfAccessor();
acc->matView = new idList<idMat4>( 1 );
acc->matView->AssureSize( 1, trans.Inverse().Transpose() );
}
idJointMat* poseMat = ( idJointMat* ) _alloca16( bones.Num() * sizeof( poseMat[0] ) );
baseFrame = GetPose( animBones[0], poseMat );
@ -818,15 +801,7 @@ idFile_Memory* idRenderModelGLTF::GetAnimBin( idStr animName , const ID_TIME_T
{
if( node->parent == nullptr )
{
//q = blenderToDoomAngels.ToQuat() * animBones[i][b].rotation;
q = blenderToDoomTransform.ToMat3().ToQuat() * animBones[i][b].rotation;
if( animBones[i].Num() == 1 )
{
// this is only hit for single bone or boneless (root is generated!) animations
q = blenderToDoomTransform.ToMat3().ToQuat() * -animBones[i][b].rotation;
}
}
else
{

View file

@ -309,8 +309,15 @@ static void CreateVulkanInstance()
{
vkcontext.instanceExtensions.AddUnique( VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME );
vkcontext.deviceProperties2Available = true;
break;
}
#if defined(__APPLE__) && defined( VK_KHR_portability_enumeration )
// SRS - Enable physical device enumeration when using the Vulkan loader on macOS (MoltenVK portability driver)
if( idStr::Icmp( instanceExtensionProps[ i ].extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME ) == 0 )
{
vkcontext.instanceExtensions.AddUnique( VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME );
createInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
}
#endif
}
vkcontext.debugUtilsSupportAvailable = false;
@ -743,7 +750,12 @@ static void SelectPhysicalDevice()
static idStr version_string;
version_string.Clear();
#if VK_HEADER_VERSION >= 176
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 ) ) );
#else
// SRS - Allow deprecated version macros on older Vulkan SDKs < 1.2.176
version_string.Append( va( "Vulkan API %i.%i.%i", VK_VERSION_MAJOR( gpu.props.apiVersion ), VK_VERSION_MINOR( gpu.props.apiVersion ), VK_VERSION_PATCH( gpu.props.apiVersion ) ) );
#endif
static idStr extensions_string;
extensions_string.Clear();
@ -761,13 +773,13 @@ static void SelectPhysicalDevice()
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 ) );
VkPhysicalDeviceProperties2 deviceProperties = {};
VkPhysicalDeviceDriverProperties driverProperties = {};
deviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
deviceProperties.pNext = &driverProperties;
driverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
vkGetPhysicalDeviceProperties2( vkcontext.physicalDevice, &deviceProperties );
version_string.Append( va( " (%s %s)", driverProperties.driverName, driverProperties.driverInfo ) );
}
glConfig.version_string = version_string.c_str();

View file

@ -452,14 +452,7 @@ idBrushList idAASBuild::AddBrushesForMapPolygonMesh( const MapPolygonMesh* mapMe
const idList<idDrawVert>& verts = mapMesh->GetDrawVerts();
const idList<int>& indices = face.GetIndexes();
idVec3 triNormal;
int v1 = 0;
int v2 = 1;
int v3 = 2;
//create brush with 2 triangles
// 1 frontface from the mappoly verts
// 1 backface, offset in direction off frontface normal at unit distance
//create brush from triangle
//Front face
d1 = verts[indices[1]].xyz - verts[indices[0]].xyz;
@ -490,35 +483,6 @@ idBrushList idAASBuild::AddBrushesForMapPolygonMesh( const MapPolygonMesh* mapMe
delete brush;
}
}
//Back face
triNormal = plane.Normal();
plane.SetNormal( d2.Cross( d1 ) );
if( plane.Normalize() != 0.0f )
{
plane.FitThroughPoint( verts[indices[0]].xyz );
w.Clear();
w += verts[indices[2]].xyz + triNormal;
w += verts[indices[1]].xyz + triNormal;
w += verts[indices[0]].xyz + triNormal;
brush = new idBrush();
brush->SetContents( contents );
if( brush->FromWinding( w, plane ) )
{
brush->SetEntityNum( entityNum );
brush->SetPrimitiveNum( primitiveNum );
brush->SetFlag( BFL_PATCH );
brush->Transform( origin, axis );
brushList.AddToTail( brush );
validBrushes++;
}
else
{
delete brush;
}
}
}
if( !validBrushes )

View file

@ -2258,7 +2258,12 @@ bool idBrushBSP::TryMergeLeafNodes( idBrushBSPPortal* portal, int side )
// replace every reference to node2 by a reference to node1
UpdateTreeAfterMerge_r( root, bounds, node2, node1 );
delete node2;
// HarrievG: fixed crash with polygon maps
if( node2->GetFlags() & NODE_DONE )
{
delete node2;
}
// HarrievG end
return true;
}