mirror of https://github.com/snes9xgit/snes9x.git
Merge branch 'snes9xgit:master' into update-minizip
This commit is contained in:
commit
496d2f0020
|
@ -49,7 +49,7 @@ snes9x_linux-x11-amd64_task:
|
|||
|
||||
snes9x_freebsd-x11-amd64_task:
|
||||
freebsd_instance:
|
||||
image: freebsd-12-1-release-amd64
|
||||
image: freebsd-13-2-release-amd64
|
||||
|
||||
setup_script:
|
||||
- pkg install -y gmake pkgconf minizip libX11 libXext
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "cheats.h"
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include <cassert>
|
||||
|
||||
static inline uint8 S9xGetByteFree(uint32 Address)
|
||||
{
|
||||
|
@ -322,6 +323,8 @@ void S9xEnableCheat(SCheat &c)
|
|||
|
||||
void S9xEnableCheatGroup(uint32 num)
|
||||
{
|
||||
assert(num < Cheat.group.size());
|
||||
|
||||
for (auto &c : Cheat.group[num].cheat)
|
||||
S9xEnableCheat(c);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,12 +23,12 @@ namespace VMA_HPP_NAMESPACE {
|
|||
return VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>(t);
|
||||
}
|
||||
template<class T, class O>
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher> createUniqueHandle(const T& t, const O* o) VULKAN_HPP_NOEXCEPT {
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher> createUniqueHandle(const T& t, O o) VULKAN_HPP_NOEXCEPT {
|
||||
return VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>(t, o);
|
||||
}
|
||||
template<class F, class S, class O>
|
||||
std::pair<VULKAN_HPP_NAMESPACE::UniqueHandle<F, Dispatcher>, VULKAN_HPP_NAMESPACE::UniqueHandle<S, Dispatcher>>
|
||||
createUniqueHandle(const std::pair<F, S>& t, const O* o) VULKAN_HPP_NOEXCEPT {
|
||||
createUniqueHandle(const std::pair<F, S>& t, O o) VULKAN_HPP_NOEXCEPT {
|
||||
return {
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<F, Dispatcher>(t.first, o),
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<S, Dispatcher>(t.second, o)
|
||||
|
@ -37,7 +37,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
|
||||
template<class T, class UniqueVectorAllocator, class VectorAllocator, class O>
|
||||
std::vector<VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>, UniqueVectorAllocator>
|
||||
createUniqueHandleVector(const std::vector<T, VectorAllocator>& vector, const O* o,
|
||||
createUniqueHandleVector(const std::vector<T, VectorAllocator>& vector, O o,
|
||||
const UniqueVectorAllocator& vectorAllocator) VULKAN_HPP_NOEXCEPT {
|
||||
std::vector<VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>, UniqueVectorAllocator> result(vectorAllocator);
|
||||
result.reserve(vector.size());
|
||||
|
@ -46,10 +46,10 @@ namespace VMA_HPP_NAMESPACE {
|
|||
}
|
||||
|
||||
template<class T, class Owner> class Deleter {
|
||||
const Owner* owner;
|
||||
Owner owner;
|
||||
public:
|
||||
Deleter() = default;
|
||||
Deleter(const Owner* owner) VULKAN_HPP_NOEXCEPT : owner(owner) {}
|
||||
Deleter(Owner owner) VULKAN_HPP_NOEXCEPT : owner(owner) {}
|
||||
protected:
|
||||
void destroy(const T& t) VULKAN_HPP_NOEXCEPT; // Implemented manually for each handle type
|
||||
};
|
||||
|
@ -85,11 +85,11 @@ namespace VMA_HPP_NAMESPACE {
|
|||
# define VMA_HPP_DESTROY_IMPL(NAME) \
|
||||
template<> VULKAN_HPP_INLINE void VULKAN_HPP_NAMESPACE::UniqueHandleTraits<NAME, Dispatcher>::deleter::destroy(const NAME& t) VULKAN_HPP_NOEXCEPT
|
||||
|
||||
VMA_HPP_DESTROY_IMPL(VULKAN_HPP_NAMESPACE::Buffer) { owner->destroyBuffer(t, nullptr); }
|
||||
VMA_HPP_DESTROY_IMPL(VULKAN_HPP_NAMESPACE::Image) { owner->destroyImage(t, nullptr); }
|
||||
VMA_HPP_DESTROY_IMPL(Pool) { owner->destroyPool(t); }
|
||||
VMA_HPP_DESTROY_IMPL(Allocation) { owner->freeMemory(t); }
|
||||
VMA_HPP_DESTROY_IMPL(VirtualAllocation) { owner->virtualFree(t); }
|
||||
VMA_HPP_DESTROY_IMPL(VULKAN_HPP_NAMESPACE::Buffer) { owner.destroyBuffer(t, nullptr); }
|
||||
VMA_HPP_DESTROY_IMPL(VULKAN_HPP_NAMESPACE::Image) { owner.destroyImage(t, nullptr); }
|
||||
VMA_HPP_DESTROY_IMPL(Pool) { owner.destroyPool(t); }
|
||||
VMA_HPP_DESTROY_IMPL(Allocation) { owner.freeMemory(t); }
|
||||
VMA_HPP_DESTROY_IMPL(VirtualAllocation) { owner.virtualFree(t); }
|
||||
|
||||
# undef VMA_HPP_DESTROY_IMPL
|
||||
#endif
|
||||
|
|
|
@ -10,7 +10,8 @@ namespace VMA_HPP_NAMESPACE {
|
|||
eExtMemoryBudget = VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT,
|
||||
eAmdDeviceCoherentMemory = VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT,
|
||||
eBufferDeviceAddress = VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT,
|
||||
eExtMemoryPriority = VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT
|
||||
eExtMemoryPriority = VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT,
|
||||
eKhrMaintenance4 = VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE4_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
|
@ -22,6 +23,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
if (value == AllocatorCreateFlagBits::eAmdDeviceCoherentMemory) return "AmdDeviceCoherentMemory";
|
||||
if (value == AllocatorCreateFlagBits::eBufferDeviceAddress) return "BufferDeviceAddress";
|
||||
if (value == AllocatorCreateFlagBits::eExtMemoryPriority) return "ExtMemoryPriority";
|
||||
if (value == AllocatorCreateFlagBits::eKhrMaintenance4) return "KhrMaintenance4";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
|
@ -37,7 +39,8 @@ namespace VULKAN_HPP_NAMESPACE {
|
|||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eExtMemoryBudget
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eAmdDeviceCoherentMemory
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eBufferDeviceAddress
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eExtMemoryPriority;
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eExtMemoryPriority
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eKhrMaintenance4;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -72,6 +75,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
if (value & AllocatorCreateFlagBits::eAmdDeviceCoherentMemory) result += "AmdDeviceCoherentMemory | ";
|
||||
if (value & AllocatorCreateFlagBits::eBufferDeviceAddress) result += "BufferDeviceAddress | ";
|
||||
if (value & AllocatorCreateFlagBits::eExtMemoryPriority) result += "ExtMemoryPriority | ";
|
||||
if (value & AllocatorCreateFlagBits::eKhrMaintenance4) result += "KhrMaintenance4 | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Pool pool;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCreatePool(m_allocator, reinterpret_cast<const VmaPoolCreateInfo*>(&createInfo), reinterpret_cast<VmaPool*>(&pool)) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::createPool");
|
||||
return createResultValueType(result, createUniqueHandle(pool, this));
|
||||
return createResultValueType(result, createUniqueHandle(pool, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -257,7 +257,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Allocation allocation;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaAllocateMemory(m_allocator, reinterpret_cast<const VkMemoryRequirements*>(&vkMemoryRequirements), reinterpret_cast<const VmaAllocationCreateInfo*>(&createInfo), reinterpret_cast<VmaAllocation*>(&allocation), reinterpret_cast<VmaAllocationInfo*>(static_cast<AllocationInfo*>(allocationInfo))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::allocateMemory");
|
||||
return createResultValueType(result, createUniqueHandle(allocation, this));
|
||||
return createResultValueType(result, createUniqueHandle(allocation, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -306,7 +306,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
std::vector<Allocation> allocations(allocationCount);
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaAllocateMemoryPages(m_allocator, reinterpret_cast<const VkMemoryRequirements*>(vkMemoryRequirements.data()), reinterpret_cast<const VmaAllocationCreateInfo*>(createInfo.data()), allocationCount, reinterpret_cast<VmaAllocation*>(allocations.data()), reinterpret_cast<VmaAllocationInfo*>(allocationInfo.data())) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::allocateMemoryPages");
|
||||
return createResultValueType(result, createUniqueHandleVector(allocations, this, vectorAllocator));
|
||||
return createResultValueType(result, createUniqueHandleVector(allocations, *this, vectorAllocator));
|
||||
}
|
||||
|
||||
template<typename VectorAllocator>
|
||||
|
@ -317,7 +317,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
std::vector<Allocation> allocations(allocationCount);
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaAllocateMemoryPages(m_allocator, reinterpret_cast<const VkMemoryRequirements*>(vkMemoryRequirements.data()), reinterpret_cast<const VmaAllocationCreateInfo*>(createInfo.data()), allocationCount, reinterpret_cast<VmaAllocation*>(allocations.data()), reinterpret_cast<VmaAllocationInfo*>(allocationInfo.data())) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::allocateMemoryPages");
|
||||
return createResultValueType(result, createUniqueHandleVector(allocations, this, VectorAllocator()));
|
||||
return createResultValueType(result, createUniqueHandleVector(allocations, *this, VectorAllocator()));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -346,7 +346,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Allocation allocation;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaAllocateMemoryForBuffer(m_allocator, static_cast<VkBuffer>(buffer), reinterpret_cast<const VmaAllocationCreateInfo*>(&createInfo), reinterpret_cast<VmaAllocation*>(&allocation), reinterpret_cast<VmaAllocationInfo*>(static_cast<AllocationInfo*>(allocationInfo))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::allocateMemoryForBuffer");
|
||||
return createResultValueType(result, createUniqueHandle(allocation, this));
|
||||
return createResultValueType(result, createUniqueHandle(allocation, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -374,7 +374,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Allocation allocation;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaAllocateMemoryForImage(m_allocator, static_cast<VkImage>(image), reinterpret_cast<const VmaAllocationCreateInfo*>(&createInfo), reinterpret_cast<VmaAllocation*>(&allocation), reinterpret_cast<VmaAllocationInfo*>(static_cast<AllocationInfo*>(allocationInfo))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::allocateMemoryForImage");
|
||||
return createResultValueType(result, createUniqueHandle(allocation, this));
|
||||
return createResultValueType(result, createUniqueHandle(allocation, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -419,6 +419,18 @@ namespace VMA_HPP_NAMESPACE {
|
|||
vmaGetAllocationInfo(m_allocator, static_cast<VmaAllocation>(allocation), reinterpret_cast<VmaAllocationInfo*>(allocationInfo));
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_INLINE AllocationInfo2 Allocator::getAllocationInfo2(Allocation allocation) const {
|
||||
AllocationInfo2 allocationInfo;
|
||||
vmaGetAllocationInfo2(m_allocator, static_cast<VmaAllocation>(allocation), reinterpret_cast<VmaAllocationInfo2*>(&allocationInfo));
|
||||
return allocationInfo;
|
||||
}
|
||||
#endif
|
||||
VULKAN_HPP_INLINE void Allocator::getAllocationInfo2(Allocation allocation,
|
||||
AllocationInfo2* allocationInfo) const {
|
||||
vmaGetAllocationInfo2(m_allocator, static_cast<VmaAllocation>(allocation), reinterpret_cast<VmaAllocationInfo2*>(allocationInfo));
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_INLINE void Allocator::setAllocationUserData(Allocation allocation,
|
||||
void* userData) const {
|
||||
|
@ -549,6 +561,57 @@ namespace VMA_HPP_NAMESPACE {
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type Allocator::copyMemoryToAllocation(const void* srcHostPointer,
|
||||
Allocation dstAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize dstAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const {
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCopyMemoryToAllocation(m_allocator, srcHostPointer, static_cast<VmaAllocation>(dstAllocation), static_cast<VkDeviceSize>(dstAllocationLocalOffset), static_cast<VkDeviceSize>(size)) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::copyMemoryToAllocation");
|
||||
return createResultValueType(result);
|
||||
}
|
||||
#else
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result Allocator::copyMemoryToAllocation(const void* srcHostPointer,
|
||||
Allocation dstAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize dstAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const {
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCopyMemoryToAllocation(m_allocator, srcHostPointer, static_cast<VmaAllocation>(dstAllocation), static_cast<VkDeviceSize>(dstAllocationLocalOffset), static_cast<VkDeviceSize>(size)) );
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template<typename VectorAllocator,
|
||||
typename B,
|
||||
typename std::enable_if<std::is_same<typename B::value_type, void>::value, int>::type>
|
||||
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<void, VectorAllocator>>::type Allocator::copyAllocationToMemory(Allocation srcAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize srcAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size,
|
||||
VectorAllocator& vectorAllocator) const {
|
||||
std::vector<void, VectorAllocator> dstHostPointer(size, vectorAllocator);
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCopyAllocationToMemory(m_allocator, static_cast<VmaAllocation>(srcAllocation), static_cast<VkDeviceSize>(srcAllocationLocalOffset), &dstHostPointer, static_cast<VkDeviceSize>(size)) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::copyAllocationToMemory");
|
||||
return createResultValueType(result, dstHostPointer);
|
||||
}
|
||||
|
||||
template<typename VectorAllocator>
|
||||
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<void, VectorAllocator>>::type Allocator::copyAllocationToMemory(Allocation srcAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize srcAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const {
|
||||
std::vector<void, VectorAllocator> dstHostPointer(size);
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCopyAllocationToMemory(m_allocator, static_cast<VmaAllocation>(srcAllocation), static_cast<VkDeviceSize>(srcAllocationLocalOffset), &dstHostPointer, static_cast<VkDeviceSize>(size)) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::copyAllocationToMemory");
|
||||
return createResultValueType(result, dstHostPointer);
|
||||
}
|
||||
#endif
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::Result Allocator::copyAllocationToMemory(Allocation srcAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize srcAllocationLocalOffset,
|
||||
void* dstHostPointer,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const {
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCopyAllocationToMemory(m_allocator, static_cast<VmaAllocation>(srcAllocation), static_cast<VkDeviceSize>(srcAllocationLocalOffset), dstHostPointer, static_cast<VkDeviceSize>(size)) );
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type Allocator::checkCorruption(uint32_t memoryTypeBits) const {
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCheckCorruption(m_allocator, memoryTypeBits) );
|
||||
|
@ -703,7 +766,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Allocation& allocation = pair.second;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCreateBuffer(m_allocator, reinterpret_cast<const VkBufferCreateInfo*>(&bufferCreateInfo), reinterpret_cast<const VmaAllocationCreateInfo*>(&allocationCreateInfo), reinterpret_cast<VkBuffer*>(&buffer), reinterpret_cast<VmaAllocation*>(&allocation), reinterpret_cast<VmaAllocationInfo*>(static_cast<AllocationInfo*>(allocationInfo))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::createBuffer");
|
||||
return createResultValueType(result, createUniqueHandle(pair, this));
|
||||
return createResultValueType(result, createUniqueHandle(pair, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -738,7 +801,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Allocation& allocation = pair.second;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCreateBufferWithAlignment(m_allocator, reinterpret_cast<const VkBufferCreateInfo*>(&bufferCreateInfo), reinterpret_cast<const VmaAllocationCreateInfo*>(&allocationCreateInfo), static_cast<VkDeviceSize>(minAlignment), reinterpret_cast<VkBuffer*>(&buffer), reinterpret_cast<VmaAllocation*>(&allocation), reinterpret_cast<VmaAllocationInfo*>(static_cast<AllocationInfo*>(allocationInfo))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::createBufferWithAlignment");
|
||||
return createResultValueType(result, createUniqueHandle(pair, this));
|
||||
return createResultValueType(result, createUniqueHandle(pair, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -818,7 +881,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
Allocation& allocation = pair.second;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaCreateImage(m_allocator, reinterpret_cast<const VkImageCreateInfo*>(&imageCreateInfo), reinterpret_cast<const VmaAllocationCreateInfo*>(&allocationCreateInfo), reinterpret_cast<VkImage*>(&image), reinterpret_cast<VmaAllocation*>(&allocation), reinterpret_cast<VmaAllocationInfo*>(static_cast<AllocationInfo*>(allocationInfo))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::Allocator::createImage");
|
||||
return createResultValueType(result, createUniqueHandle(pair, this));
|
||||
return createResultValueType(result, createUniqueHandle(pair, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -949,7 +1012,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
VirtualAllocation allocation;
|
||||
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( vmaVirtualAllocate(m_virtualBlock, reinterpret_cast<const VmaVirtualAllocationCreateInfo*>(&createInfo), reinterpret_cast<VmaVirtualAllocation*>(&allocation), reinterpret_cast<VkDeviceSize*>(static_cast<VULKAN_HPP_NAMESPACE::DeviceSize*>(offset))) );
|
||||
resultCheck(result, VMA_HPP_NAMESPACE_STRING "::VirtualBlock::virtualAllocate");
|
||||
return createResultValueType(result, createUniqueHandle(allocation, this));
|
||||
return createResultValueType(result, createUniqueHandle(allocation, *this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
struct AllocationCreateInfo;
|
||||
struct PoolCreateInfo;
|
||||
struct AllocationInfo;
|
||||
struct AllocationInfo2;
|
||||
struct DefragmentationInfo;
|
||||
struct DefragmentationMove;
|
||||
struct DefragmentationPassMoveInfo;
|
||||
|
@ -455,6 +456,12 @@ namespace VMA_HPP_NAMESPACE {
|
|||
void getAllocationInfo(Allocation allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS AllocationInfo2 getAllocationInfo2(Allocation allocation) const;
|
||||
#endif
|
||||
void getAllocationInfo2(Allocation allocation,
|
||||
AllocationInfo2* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void setAllocationUserData(Allocation allocation,
|
||||
void* userData) const;
|
||||
|
@ -529,6 +536,37 @@ namespace VMA_HPP_NAMESPACE {
|
|||
const VULKAN_HPP_NAMESPACE::DeviceSize* offsets,
|
||||
const VULKAN_HPP_NAMESPACE::DeviceSize* sizes) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type copyMemoryToAllocation(const void* srcHostPointer,
|
||||
Allocation dstAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize dstAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result copyMemoryToAllocation(const void* srcHostPointer,
|
||||
Allocation dstAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize dstAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template<typename VectorAllocator = std::allocator<void>,
|
||||
typename B = VectorAllocator,
|
||||
typename std::enable_if<std::is_same<typename B::value_type, void>::value, int>::type = 0>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<void, VectorAllocator>>::type copyAllocationToMemory(Allocation srcAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize srcAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size,
|
||||
VectorAllocator& vectorAllocator) const;
|
||||
|
||||
template<typename VectorAllocator = std::allocator<void>>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<void, VectorAllocator>>::type copyAllocationToMemory(Allocation srcAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize srcAllocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result copyAllocationToMemory(Allocation srcAllocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize srcAllocationLocalOffset,
|
||||
void* dstHostPointer,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type checkCorruption(uint32_t memoryTypeBits) const;
|
||||
#else
|
||||
|
|
|
@ -111,9 +111,9 @@ namespace VMA_HPP_NAMESPACE {
|
|||
#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
|
||||
, PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR_ = {}
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION >= 1003000
|
||||
, PFN_vkGetDeviceBufferMemoryRequirements vkGetDeviceBufferMemoryRequirements_ = {}
|
||||
, PFN_vkGetDeviceImageMemoryRequirements vkGetDeviceImageMemoryRequirements_ = {}
|
||||
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
|
||||
, PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequirements_ = {}
|
||||
, PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirements_ = {}
|
||||
#endif
|
||||
) VULKAN_HPP_NOEXCEPT
|
||||
: vkGetInstanceProcAddr(vkGetInstanceProcAddr_)
|
||||
|
@ -146,7 +146,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
|
||||
, vkGetPhysicalDeviceMemoryProperties2KHR(vkGetPhysicalDeviceMemoryProperties2KHR_)
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION >= 1003000
|
||||
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
|
||||
, vkGetDeviceBufferMemoryRequirements(vkGetDeviceBufferMemoryRequirements_)
|
||||
, vkGetDeviceImageMemoryRequirements(vkGetDeviceImageMemoryRequirements_)
|
||||
#endif
|
||||
|
@ -204,7 +204,7 @@ namespace VMA_HPP_NAMESPACE {
|
|||
#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
|
||||
&& vkGetPhysicalDeviceMemoryProperties2KHR == rhs.vkGetPhysicalDeviceMemoryProperties2KHR
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION >= 1003000
|
||||
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
|
||||
&& vkGetDeviceBufferMemoryRequirements == rhs.vkGetDeviceBufferMemoryRequirements
|
||||
&& vkGetDeviceImageMemoryRequirements == rhs.vkGetDeviceImageMemoryRequirements
|
||||
#endif
|
||||
|
@ -339,14 +339,14 @@ namespace VMA_HPP_NAMESPACE {
|
|||
return *this;
|
||||
}
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION >= 1003000
|
||||
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 VulkanFunctions& setVkGetDeviceBufferMemoryRequirements(PFN_vkGetDeviceBufferMemoryRequirements vkGetDeviceBufferMemoryRequirements_) VULKAN_HPP_NOEXCEPT {
|
||||
VULKAN_HPP_CONSTEXPR_14 VulkanFunctions& setVkGetDeviceBufferMemoryRequirements(PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequirements_) VULKAN_HPP_NOEXCEPT {
|
||||
vkGetDeviceBufferMemoryRequirements = vkGetDeviceBufferMemoryRequirements_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 VulkanFunctions& setVkGetDeviceImageMemoryRequirements(PFN_vkGetDeviceImageMemoryRequirements vkGetDeviceImageMemoryRequirements_) VULKAN_HPP_NOEXCEPT {
|
||||
VULKAN_HPP_CONSTEXPR_14 VulkanFunctions& setVkGetDeviceImageMemoryRequirements(PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirements_) VULKAN_HPP_NOEXCEPT {
|
||||
vkGetDeviceImageMemoryRequirements = vkGetDeviceImageMemoryRequirements_;
|
||||
return *this;
|
||||
}
|
||||
|
@ -384,9 +384,9 @@ namespace VMA_HPP_NAMESPACE {
|
|||
#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR = {};
|
||||
#endif
|
||||
#if VMA_VULKAN_VERSION >= 1003000
|
||||
PFN_vkGetDeviceBufferMemoryRequirements vkGetDeviceBufferMemoryRequirements = {};
|
||||
PFN_vkGetDeviceImageMemoryRequirements vkGetDeviceImageMemoryRequirements = {};
|
||||
#if VMA_KHR_MAINTENANCE4 || VMA_VULKAN_VERSION >= 1003000
|
||||
PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequirements = {};
|
||||
PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirements = {};
|
||||
#endif
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(VulkanFunctions) == sizeof(VmaVulkanFunctions),
|
||||
|
@ -1297,6 +1297,79 @@ namespace VMA_HPP_NAMESPACE {
|
|||
VULKAN_HPP_STATIC_ASSERT(std::is_nothrow_move_constructible<AllocationInfo>::value,
|
||||
"AllocationInfo is not nothrow_move_constructible!");
|
||||
|
||||
struct AllocationInfo2 {
|
||||
using NativeType = VmaAllocationInfo2;
|
||||
|
||||
#if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
|
||||
VULKAN_HPP_CONSTEXPR AllocationInfo2(
|
||||
AllocationInfo allocationInfo_ = {}
|
||||
, VULKAN_HPP_NAMESPACE::DeviceSize blockSize_ = {}
|
||||
, VULKAN_HPP_NAMESPACE::Bool32 dedicatedMemory_ = {}
|
||||
) VULKAN_HPP_NOEXCEPT
|
||||
: allocationInfo(allocationInfo_)
|
||||
, blockSize(blockSize_)
|
||||
, dedicatedMemory(dedicatedMemory_)
|
||||
{}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR AllocationInfo2(AllocationInfo2 const &) VULKAN_HPP_NOEXCEPT = default;
|
||||
AllocationInfo2(VmaAllocationInfo2 const & rhs) VULKAN_HPP_NOEXCEPT : AllocationInfo2(*reinterpret_cast<AllocationInfo2 const *>(&rhs)) {}
|
||||
#endif
|
||||
|
||||
AllocationInfo2& operator=(AllocationInfo2 const &) VULKAN_HPP_NOEXCEPT = default;
|
||||
AllocationInfo2& operator=(VmaAllocationInfo2 const & rhs) VULKAN_HPP_NOEXCEPT {
|
||||
*this = *reinterpret_cast<VMA_HPP_NAMESPACE::AllocationInfo2 const *>(&rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit operator VmaAllocationInfo2 const &() const VULKAN_HPP_NOEXCEPT {
|
||||
return *reinterpret_cast<const VmaAllocationInfo2 *>(this);
|
||||
}
|
||||
|
||||
explicit operator VmaAllocationInfo2&() VULKAN_HPP_NOEXCEPT {
|
||||
return *reinterpret_cast<VmaAllocationInfo2 *>(this);
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
bool operator==(AllocationInfo2 const &) const = default;
|
||||
#else
|
||||
bool operator==(AllocationInfo2 const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return allocationInfo == rhs.allocationInfo
|
||||
&& blockSize == rhs.blockSize
|
||||
&& dedicatedMemory == rhs.dedicatedMemory
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined( VULKAN_HPP_NO_STRUCT_SETTERS )
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 AllocationInfo2& setAllocationInfo(AllocationInfo allocationInfo_) VULKAN_HPP_NOEXCEPT {
|
||||
allocationInfo = allocationInfo_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 AllocationInfo2& setBlockSize(VULKAN_HPP_NAMESPACE::DeviceSize blockSize_) VULKAN_HPP_NOEXCEPT {
|
||||
blockSize = blockSize_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR_14 AllocationInfo2& setDedicatedMemory(VULKAN_HPP_NAMESPACE::Bool32 dedicatedMemory_) VULKAN_HPP_NOEXCEPT {
|
||||
dedicatedMemory = dedicatedMemory_;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
AllocationInfo allocationInfo = {};
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize blockSize = {};
|
||||
VULKAN_HPP_NAMESPACE::Bool32 dedicatedMemory = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(AllocationInfo2) == sizeof(VmaAllocationInfo2),
|
||||
"struct and wrapper have different size!");
|
||||
VULKAN_HPP_STATIC_ASSERT(std::is_standard_layout<AllocationInfo2>::value,
|
||||
"struct wrapper is not a standard layout!");
|
||||
VULKAN_HPP_STATIC_ASSERT(std::is_nothrow_move_constructible<AllocationInfo2>::value,
|
||||
"AllocationInfo2 is not nothrow_move_constructible!");
|
||||
|
||||
struct DefragmentationInfo {
|
||||
using NativeType = VmaDefragmentationInfo;
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 870a531486f77dfaf124395de80ed38867400d31
|
||||
Subproject commit 577baa05033cf1d9236b3d078ca4b3269ed87a2b
|
|
@ -142,7 +142,7 @@ uint8 S9xGetSuperFX (uint16 address)
|
|||
|
||||
void S9xSuperFXExec (void)
|
||||
{
|
||||
if ((Memory.FillRAM[0x3000 + GSU_SFR] & FLG_G) && (Memory.FillRAM[0x3000 + GSU_SCMR] & 0x18) == 0x18)
|
||||
if ((Memory.FillRAM[0x3000 + GSU_SFR] & FLG_G) && (Memory.FillRAM[0x3000 + GSU_SCMR] & 0x18) != 0)
|
||||
{
|
||||
FxEmulate(((Memory.FillRAM[0x3000 + GSU_CLSR] & 1) ? (SuperFX.speedPerLine * 5 / 2) : SuperFX.speedPerLine) * Settings.SuperFXClockMultiplier / 100);
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ if(USE_SLANG)
|
|||
list(APPEND DEFINES "VK_USE_PLATFORM_XLIB_KHR"
|
||||
"VK_USE_PLATFORM_WAYLAND_KHR"
|
||||
"VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1"
|
||||
"VULKAN_HPP_NO_NODISCARD_WARNINGS=1"
|
||||
"VULKAN_HPP_NO_EXCEPTIONS=1"
|
||||
"VMA_DYNAMIC_VULKAN_FUNCTIONS=1"
|
||||
"VMA_STATIC_VULKAN_FUNCTIONS=0"
|
||||
"IMGUI_IMPL_VULKAN_NO_PROTOTYPES")
|
||||
|
|
|
@ -58,7 +58,7 @@ bool S9xVulkanDisplayDriver::init_imgui()
|
|||
.setPoolSizes(pool_sizes)
|
||||
.setMaxSets(1000)
|
||||
.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
|
||||
imgui_descriptor_pool = device.createDescriptorPoolUnique(descriptor_pool_create_info);
|
||||
imgui_descriptor_pool = device.createDescriptorPoolUnique(descriptor_pool_create_info).value;
|
||||
|
||||
ImGui_ImplVulkan_InitInfo init_info{};
|
||||
init_info.Instance = context->instance.get();
|
||||
|
|
|
@ -40,7 +40,6 @@ class S9xVulkanDisplayDriver : public S9xDisplayDriver
|
|||
std::unique_ptr<Vulkan::Context> context;
|
||||
vk::Device device;
|
||||
vk::UniqueDescriptorPool imgui_descriptor_pool;
|
||||
vk::UniqueRenderPass imgui_render_pass;
|
||||
|
||||
GdkDisplay *gdk_display;
|
||||
GdkWindow *gdk_window;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
project(snes9x-qt VERSION 1.61)
|
||||
project(snes9x-qt VERSION 1.62)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
@ -102,8 +102,15 @@ list(APPEND INCLUDES ${SDL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
|
|||
list(APPEND FLAGS ${SDL_COMPILE_FLAGS} ${ZLIB_COMPILE_FLAGS})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
list(APPEND LIBS opengl32 libSDL2.a libz.a libc++.a)
|
||||
list(APPEND LIBS gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32 dinput8)
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
message("Clang compiler, using libc++.")
|
||||
list(APPEND LIBS libc++.a)
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
||||
message("GNU compiler, using libstdc++.")
|
||||
list(APPEND LIBS libstdc++.a)
|
||||
endif()
|
||||
|
||||
list(APPEND LIBS libSDL2.a libz.a opengl32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32 dinput8)
|
||||
list(APPEND DEFINES SDL_MAIN_HANDLED)
|
||||
list(APPEND PLATFORM_SOURCES
|
||||
../common/video/wgl_context.cpp
|
||||
|
@ -228,6 +235,8 @@ endif()
|
|||
|
||||
list(APPEND DEFINES
|
||||
"VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1"
|
||||
"VULKAN_HPP_NO_NODISCARD_WARNINGS=1"
|
||||
"VULKAN_HPP_NO_EXCEPTIONS=1"
|
||||
"VMA_DYNAMIC_VULKAN_FUNCTIONS=1"
|
||||
"VMA_STATIC_VULKAN_FUNCTIONS=0"
|
||||
"USE_SLANG")
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <QtEvents>
|
||||
#include <QTimer>
|
||||
|
||||
ControllerPanel::ControllerPanel(EmuApplication *app)
|
||||
: BindingPanel(app)
|
||||
ControllerPanel::ControllerPanel(EmuApplication *app_)
|
||||
: BindingPanel(app_)
|
||||
{
|
||||
setupUi(this);
|
||||
QObject::connect(controllerComboBox, &QComboBox::currentIndexChanged, [&](int index) {
|
||||
|
@ -57,6 +57,11 @@ ControllerPanel::ControllerPanel(EmuApplication *app)
|
|||
|
||||
recreateAutoAssignMenu();
|
||||
onJoypadsChanged([&]{ recreateAutoAssignMenu(); });
|
||||
|
||||
connect(portComboBox, &QComboBox::currentIndexChanged, [&](int index) {
|
||||
this->app->config->port_configuration = index;
|
||||
app->updateBindings();
|
||||
});
|
||||
}
|
||||
|
||||
void ControllerPanel::recreateAutoAssignMenu()
|
||||
|
@ -166,6 +171,7 @@ void ControllerPanel::showEvent(QShowEvent *event)
|
|||
{
|
||||
BindingPanel::showEvent(event);
|
||||
recreateAutoAssignMenu();
|
||||
portComboBox->setCurrentIndex(app->config->port_configuration);
|
||||
}
|
||||
|
||||
ControllerPanel::~ControllerPanel()
|
||||
|
|
|
@ -14,6 +14,52 @@
|
|||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Controller Ports:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="portComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>One Controller</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Two Controllers</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mouse + Controller</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SuperScope + Controller</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Controller + Multitap</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
|
@ -58,7 +104,7 @@
|
|||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -86,7 +132,7 @@
|
|||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::DelayedPopup</enum>
|
||||
<enum>QToolButton::ToolButtonPopupMode::DelayedPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -118,7 +164,7 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -136,10 +182,10 @@
|
|||
<string><html><head/><body><p>This box lists keyboard keys and gamepad buttons mapped to the SNES controller. There are 4 slots, so you can assign 4 different keys or buttons to one SNES button.</p><p>To set a binding, click a box or highlight it with the keyboard and press Enter/Return. The box will show three dots &quot;...&quot;. Press the desired key or gamepad button to assign it to that box. The Escape key will clear the box.</p></body></html></string>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
<enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderCascadingSectionResizes">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#include <QThread>
|
||||
#include <QStyleHints>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#undef SOUND_BUFFER_WINDOW
|
||||
|
||||
|
@ -65,7 +63,11 @@ void EmuApplication::restartAudio()
|
|||
}
|
||||
|
||||
#ifdef SOUND_BUFFER_WINDOW
|
||||
|
||||
#include <QProgressDialog>
|
||||
#include <chrono>
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static void trackBufferLevel(int percent, QWidget *parent)
|
||||
{
|
||||
static uint64_t total = 0;
|
||||
|
@ -139,13 +141,6 @@ void EmuApplication::startGame()
|
|||
if (window->canvas)
|
||||
{
|
||||
window->output((uint8_t *)data, width, height, QImage::Format_RGB16, stride_bytes, frame_rate);
|
||||
// QMetaObject::invokeMethod(window.get(), "output", Qt::ConnectionType::DirectConnection,
|
||||
// Q_ARG(uint8_t *, (uint8_t *)data),
|
||||
// Q_ARG(int, width),
|
||||
// Q_ARG(int, height),
|
||||
// Q_ARG(QImage::Format, QImage::Format_RGB16),
|
||||
// Q_ARG(int, stride_bytes),
|
||||
// Q_ARG(double, frame_rate));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -248,6 +243,7 @@ void EmuApplication::startThread()
|
|||
bool EmuApplication::openFile(std::string filename)
|
||||
{
|
||||
window->gameChanging();
|
||||
updateSettings();
|
||||
suspendThread();
|
||||
auto result = core->openFile(filename);
|
||||
unsuspendThread();
|
||||
|
@ -365,6 +361,15 @@ void EmuApplication::handleBinding(std::string name, bool pressed)
|
|||
{
|
||||
loadState(save_slot);
|
||||
}
|
||||
else if (name == "SwapControllers1and2")
|
||||
{
|
||||
int num_bindings = EmuConfig::num_controller_bindings * EmuConfig::allowed_bindings;
|
||||
EmuBinding temp[num_bindings];
|
||||
memcpy(temp, config->binding.controller[0].buttons, sizeof(temp));
|
||||
memcpy(config->binding.controller[0].buttons, config->binding.controller[1].buttons, sizeof(temp));
|
||||
memcpy(config->binding.controller[1].buttons, temp, sizeof(temp));
|
||||
updateBindings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,14 +548,14 @@ void EmuApplication::disableAllCheats()
|
|||
|
||||
void EmuApplication::enableCheat(int index)
|
||||
{
|
||||
emu_thread->runOnThread([&] {
|
||||
emu_thread->runOnThread([&, index] {
|
||||
core->enableCheat(index);
|
||||
});
|
||||
}
|
||||
|
||||
void EmuApplication::disableCheat(int index)
|
||||
{
|
||||
emu_thread->runOnThread([&] {
|
||||
emu_thread->runOnThread([&, index] {
|
||||
core->disableCheat(index);
|
||||
});
|
||||
}
|
||||
|
@ -565,7 +570,7 @@ bool EmuApplication::addCheat(std::string description, std::string code)
|
|||
|
||||
void EmuApplication::deleteCheat(int index)
|
||||
{
|
||||
emu_thread->runOnThread([&] {
|
||||
emu_thread->runOnThread([&, index] {
|
||||
core->deleteCheat(index);
|
||||
});
|
||||
}
|
||||
|
@ -611,11 +616,6 @@ QString EmuApplication::iconPrefix()
|
|||
const char *whiteicons = ":/icons/whiteicons/";
|
||||
const char *blackicons = ":/icons/blackicons/";
|
||||
|
||||
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark)
|
||||
return whiteicons;
|
||||
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light)
|
||||
return blackicons;
|
||||
|
||||
if (QGuiApplication::palette().color(QPalette::WindowText).lightness() >
|
||||
QGuiApplication::palette().color(QPalette::Window).lightness())
|
||||
return whiteicons;
|
||||
|
|
|
@ -52,7 +52,7 @@ bool EmuCanvasVulkan::initImGui()
|
|||
.setPoolSizes(pool_sizes)
|
||||
.setMaxSets(1000)
|
||||
.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
|
||||
imgui_descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info);
|
||||
imgui_descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info).value;
|
||||
|
||||
ImGui_ImplVulkan_InitInfo init_info{};
|
||||
init_info.Instance = context->instance.get();
|
||||
|
@ -277,7 +277,6 @@ void EmuCanvasVulkan::deinit()
|
|||
if (context)
|
||||
context->wait_idle();
|
||||
imgui_descriptor_pool.reset();
|
||||
imgui_render_pass.reset();
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
@ -339,7 +338,6 @@ void EmuCanvasVulkan::recreateUIAssets()
|
|||
{
|
||||
context->wait_idle();
|
||||
imgui_descriptor_pool.reset();
|
||||
imgui_render_pass.reset();
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ class EmuCanvasVulkan : public EmuCanvas
|
|||
|
||||
bool initImGui();
|
||||
void recreateUIAssets() override;
|
||||
vk::UniqueRenderPass imgui_render_pass;
|
||||
vk::UniqueDescriptorPool imgui_descriptor_pool;
|
||||
|
||||
std::unique_ptr<Vulkan::Context> context;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
|
@ -286,6 +285,7 @@ bool EmuConfig::setDefaults(int section)
|
|||
if (section == -1 || section == 4)
|
||||
{
|
||||
// Controllers
|
||||
port_configuration = 0;
|
||||
memset(binding.controller, 0, sizeof(binding.controller));
|
||||
|
||||
const char *button_list[] = { "Up", "Down", "Left", "Right", "d", "c", "s", "x", "z", "a", "Return", "Space" };
|
||||
|
@ -494,6 +494,10 @@ void EmuConfig::config(std::string filename, bool write)
|
|||
Enum("SoundFilter", sound_filter, { "Gaussian", "Nearest", "Linear", "Cubic", "Sinc" });
|
||||
EndSection();
|
||||
|
||||
BeginSection("Ports");
|
||||
Enum("PortConfiguration", port_configuration, { "OneController", "TwoControllers", "Mouse", "SuperScope", "Multitap" });
|
||||
EndSection();
|
||||
|
||||
const char *names[] = { "Up", "Down", "Left", "Right", "A", "B", "X", "Y", "L", "R", "Start", "Select", "Turbo_A", "Turbo_B", "Turbo_X", "Turbo_Y", "Turbo_L", "Turbo_R" };
|
||||
for (int c = 0; c < 5; c++)
|
||||
{
|
||||
|
|
|
@ -157,6 +157,16 @@ struct EmuConfig
|
|||
|
||||
int sram_save_interval;
|
||||
|
||||
enum PortConfiguration
|
||||
{
|
||||
eOneController = 0,
|
||||
eTwoControllers,
|
||||
eMousePlusController,
|
||||
eSuperScopePlusController,
|
||||
eControllerPlusMultitap
|
||||
};
|
||||
int port_configuration;
|
||||
|
||||
static const int allowed_bindings = 4;
|
||||
static const int num_controller_bindings = 18;
|
||||
static const int num_shortcuts = 55;
|
||||
|
|
|
@ -660,6 +660,7 @@ void EmuMainWindow::pauseContinue()
|
|||
{
|
||||
manual_pause = true;
|
||||
app->pause();
|
||||
canvas->paintEvent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
<enum>Qt::FocusPolicy::NoFocus</enum>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
|
@ -28,10 +28,10 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
<enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Fixed</enum>
|
||||
<enum>QListView::ResizeMode::Fixed</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -115,7 +115,7 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="defaultsButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
<enum>Qt::FocusPolicy::TabFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Restore all settings on the current page to their default values.</string>
|
||||
|
@ -126,10 +126,6 @@
|
|||
<property name="text">
|
||||
<string>Restore Defaults</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="view-refresh">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -151,7 +147,7 @@
|
|||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
@ -166,10 +162,6 @@
|
|||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="window-close">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -26,7 +26,7 @@ void FoldersPanel::connectEntry(QComboBox *combo, QLineEdit *lineEdit, QPushButt
|
|||
|
||||
QObject::connect(combo, &QComboBox::activated, [=](int index) {
|
||||
*location = index;
|
||||
refreshEntry(combo, lineEdit, browse, location, folder);
|
||||
this->refreshEntry(combo, lineEdit, browse, location, folder);
|
||||
app->updateSettings();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
#include "Snes9xController.hpp"
|
||||
#include "EmuConfig.hpp"
|
||||
#include "SoftwareScalers.hpp"
|
||||
#include <memory>
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "srtc.h"
|
||||
#include "apu/apu.h"
|
||||
#include "apu/bapu/snes/snes.hpp"
|
||||
#include "gfx.h"
|
||||
#include "snapshot.h"
|
||||
#include "controls.h"
|
||||
|
@ -610,8 +608,28 @@ void Snes9xController::updateBindings(const EmuConfig *const config)
|
|||
|
||||
S9xUnmapAllControls();
|
||||
|
||||
S9xSetController(0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
S9xSetController(1, CTL_JOYPAD, 1, 1, 1, 1);
|
||||
switch (config->port_configuration)
|
||||
{
|
||||
case EmuConfig::eTwoControllers:
|
||||
S9xSetController(0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
S9xSetController(1, CTL_JOYPAD, 1, 1, 1, 1);
|
||||
break;
|
||||
case EmuConfig::eMousePlusController:
|
||||
S9xSetController(0, CTL_MOUSE, 0, 0, 0, 0);
|
||||
S9xSetController(1, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
break;
|
||||
case EmuConfig::eSuperScopePlusController:
|
||||
S9xSetController(0, CTL_SUPERSCOPE, 0, 0, 0, 0);
|
||||
S9xSetController(1, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
break;
|
||||
case EmuConfig::eControllerPlusMultitap:
|
||||
S9xSetController(0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
S9xSetController(1, CTL_MP5, 1, 2, 3, 4);
|
||||
break;
|
||||
default:
|
||||
S9xSetController(0, CTL_JOYPAD, 0, 0, 0, 0);
|
||||
S9xSetController(1, CTL_NONE, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
for (int controller_number = 0; controller_number < 5; controller_number++)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <clocale>
|
||||
#include <qnamespace.h>
|
||||
#include <QStyle>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <csignal>
|
||||
|
@ -25,6 +26,39 @@ int main(int argc, char *argv[])
|
|||
|
||||
QGuiApplication::setDesktopFileName("snes9x-gtk");
|
||||
|
||||
if (emu.qtapp->platformName() == "windows")
|
||||
{
|
||||
emu.qtapp->setStyle("fusion");
|
||||
|
||||
const QColor darkGray(53, 53, 53);
|
||||
const QColor gray(128, 128, 128);
|
||||
const QColor black(25, 25, 25);
|
||||
const QColor blue(198, 238, 255);
|
||||
const QColor blue2(0, 88, 208);
|
||||
|
||||
QPalette darkPalette;
|
||||
darkPalette.setColor(QPalette::Window, darkGray);
|
||||
darkPalette.setColor(QPalette::WindowText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Base, black);
|
||||
darkPalette.setColor(QPalette::AlternateBase, darkGray);
|
||||
darkPalette.setColor(QPalette::ToolTipBase, blue2);
|
||||
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Text, Qt::white);
|
||||
darkPalette.setColor(QPalette::Button, darkGray);
|
||||
darkPalette.setColor(QPalette::ButtonText, Qt::white);
|
||||
darkPalette.setColor(QPalette::Link, blue);
|
||||
darkPalette.setColor(QPalette::Highlight, blue2);
|
||||
darkPalette.setColor(QPalette::HighlightedText, Qt::white);
|
||||
darkPalette.setColor(QPalette::PlaceholderText, QColor(Qt::white).darker());
|
||||
|
||||
darkPalette.setColor(QPalette::Active, QPalette::Button, darkGray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray);
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::Light, darkGray);
|
||||
emu.qtapp->setPalette(darkPalette);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
auto quit_handler = [](int) { QApplication::quit(); };
|
||||
for (auto s : { SIGQUIT, SIGINT, SIGTERM, SIGHUP })
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
#define VMA_IMPLEMENTATION
|
||||
#define VMA_NULLABLE
|
||||
#define VMA_NOT_NULL
|
||||
#include "vulkan_context.hpp"
|
|
@ -1,10 +1,7 @@
|
|||
#include <exception>
|
||||
#include <cstring>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "vulkan_context.hpp"
|
||||
#include "slang_shader.hpp"
|
||||
|
||||
namespace Vulkan
|
||||
{
|
||||
|
@ -19,18 +16,14 @@ Context::~Context()
|
|||
{
|
||||
if (!device)
|
||||
return;
|
||||
device.waitIdle();
|
||||
|
||||
swapchain = nullptr;
|
||||
|
||||
wait_idle();
|
||||
swapchain.reset();
|
||||
command_pool.reset();
|
||||
descriptor_pool.reset();
|
||||
|
||||
allocator.destroy();
|
||||
|
||||
surface.reset();
|
||||
device.waitIdle();
|
||||
|
||||
wait_idle();
|
||||
device.destroy();
|
||||
}
|
||||
|
||||
|
@ -59,21 +52,24 @@ static vk::UniqueInstance create_instance_preamble(const char *wsi_extension)
|
|||
if (!dl || !dl->success())
|
||||
return {};
|
||||
|
||||
std::vector<const char *> extensions = { wsi_extension, VK_KHR_SURFACE_EXTENSION_NAME };
|
||||
vk::ApplicationInfo application_info({}, {}, {}, {}, VK_API_VERSION_1_0);
|
||||
std::vector<const char *> extensions = {
|
||||
wsi_extension,
|
||||
VK_KHR_SURFACE_EXTENSION_NAME
|
||||
};
|
||||
vk::ApplicationInfo application_info({}, {}, {}, {}, VK_API_VERSION_1_1);
|
||||
vk::InstanceCreateInfo instance_create_info({}, &application_info, {}, extensions);
|
||||
|
||||
vk::UniqueInstance instance;
|
||||
try {
|
||||
instance = vk::createInstanceUnique(instance_create_info);
|
||||
} catch (std::exception &e) {
|
||||
auto [result, instance] = vk::createInstanceUnique(instance_create_info);
|
||||
|
||||
if (result != vk::Result::eSuccess)
|
||||
{
|
||||
instance.reset();
|
||||
return {};
|
||||
}
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(instance.get());
|
||||
|
||||
return instance;
|
||||
return std::move(instance);
|
||||
}
|
||||
|
||||
std::vector<std::string> Vulkan::Context::get_device_list()
|
||||
|
@ -83,7 +79,7 @@ std::vector<std::string> Vulkan::Context::get_device_list()
|
|||
if (!instance)
|
||||
return {};
|
||||
|
||||
auto device_list = instance->enumeratePhysicalDevices();
|
||||
auto [result, device_list] = instance->enumeratePhysicalDevices();
|
||||
for (auto &d : device_list)
|
||||
{
|
||||
auto props = d.getProperties();
|
||||
|
@ -106,7 +102,7 @@ bool Context::init_win32(HINSTANCE hinstance, HWND hwnd, int preferred_device)
|
|||
auto win32_surface_create_info = vk::Win32SurfaceCreateInfoKHR{}
|
||||
.setHinstance(hinstance)
|
||||
.setHwnd(hwnd);
|
||||
surface = instance->createWin32SurfaceKHRUnique(win32_surface_create_info);
|
||||
surface = instance->createWin32SurfaceKHRUnique(win32_surface_create_info).value;
|
||||
if (!surface)
|
||||
return false;
|
||||
return init(preferred_device);
|
||||
|
@ -120,10 +116,11 @@ bool Context::init_Xlib(Display *dpy, Window xid, int preferred_device)
|
|||
if (!instance)
|
||||
return false;
|
||||
|
||||
surface = instance->createXlibSurfaceKHRUnique({ {}, dpy, xid });
|
||||
|
||||
if (!surface)
|
||||
auto retval = instance->createXlibSurfaceKHRUnique({ {}, dpy, xid });
|
||||
if (retval.result != vk::Result::eSuccess)
|
||||
return false;
|
||||
surface = std::move(retval.value);
|
||||
|
||||
return init(preferred_device);
|
||||
}
|
||||
#endif
|
||||
|
@ -138,28 +135,24 @@ bool Context::init_wayland(wl_display *dpy, wl_surface *parent, int initial_widt
|
|||
auto wayland_surface_create_info = vk::WaylandSurfaceCreateInfoKHR{}
|
||||
.setSurface(parent)
|
||||
.setDisplay(dpy);
|
||||
surface = instance->createWaylandSurfaceKHRUnique(wayland_surface_create_info);
|
||||
if (!surface)
|
||||
return false;
|
||||
|
||||
init_device(preferred_device);
|
||||
init_vma();
|
||||
init_command_pool();
|
||||
init_descriptor_pool();
|
||||
create_swapchain(initial_width, initial_height);
|
||||
wait_idle();
|
||||
return true;
|
||||
auto [result, new_surface] = instance->createWaylandSurfaceKHRUnique(wayland_surface_create_info);
|
||||
if (result != vk::Result::eSuccess)
|
||||
return false;
|
||||
surface = std::move(new_surface);
|
||||
|
||||
return init(preferred_device, initial_width, initial_height);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Context::init(int preferred_device)
|
||||
bool Context::init(int preferred_device, int initial_width, int initial_height)
|
||||
{
|
||||
init_device(preferred_device);
|
||||
init_vma();
|
||||
init_command_pool();
|
||||
init_descriptor_pool();
|
||||
|
||||
create_swapchain();
|
||||
create_swapchain(initial_width, initial_height);
|
||||
wait_idle();
|
||||
return true;
|
||||
}
|
||||
|
@ -173,7 +166,9 @@ bool Context::init_descriptor_pool()
|
|||
.setPoolSizes(descriptor_pool_size)
|
||||
.setMaxSets(20)
|
||||
.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
|
||||
descriptor_pool = device.createDescriptorPoolUnique(descriptor_pool_create_info);
|
||||
|
||||
auto retval = device.createDescriptorPoolUnique(descriptor_pool_create_info);
|
||||
descriptor_pool = std::move(retval.value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -182,56 +177,70 @@ bool Context::init_command_pool()
|
|||
{
|
||||
vk::CommandPoolCreateInfo cpci({}, graphics_queue_family_index);
|
||||
cpci.setFlags(vk::CommandPoolCreateFlagBits::eResetCommandBuffer);
|
||||
command_pool = device.createCommandPoolUnique(cpci);
|
||||
auto retval = device.createCommandPoolUnique(cpci);
|
||||
command_pool = std::move(retval.value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Context::init_device(int preferred_device)
|
||||
{
|
||||
auto device_list = instance->enumeratePhysicalDevices();
|
||||
|
||||
auto find_device = [&]() -> vk::PhysicalDevice {
|
||||
for (auto &d : device_list)
|
||||
{
|
||||
auto ep = d.enumerateDeviceExtensionProperties();
|
||||
auto exists = std::find_if(ep.begin(), ep.end(), [](vk::ExtensionProperties &ext) {
|
||||
return (std::string(ext.extensionName.data()) == VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
const char *required_extensions[] = {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
// VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME
|
||||
};
|
||||
auto check_extensions = [&](vk::PhysicalDevice &device) -> bool {
|
||||
auto [retval, props] = device.enumerateDeviceExtensionProperties();
|
||||
for (const auto &extension : required_extensions) {
|
||||
auto found = std::find_if(
|
||||
props.begin(), props.end(), [&](vk::ExtensionProperties &ext) {
|
||||
return (std::string(ext.extensionName.data()) == extension);
|
||||
});
|
||||
|
||||
if (exists != ep.end())
|
||||
return d;
|
||||
return found != props.end();
|
||||
}
|
||||
return device_list[0];
|
||||
return true;
|
||||
};
|
||||
|
||||
if (preferred_device > -1 && (size_t)preferred_device < device_list.size())
|
||||
auto device_list = instance->enumeratePhysicalDevices().value;
|
||||
|
||||
if (preferred_device > -1 &&
|
||||
preferred_device < device_list.size() &&
|
||||
check_extensions(device_list[preferred_device]))
|
||||
{
|
||||
physical_device = device_list[preferred_device];
|
||||
}
|
||||
else
|
||||
physical_device = find_device();
|
||||
{
|
||||
for (auto &device : device_list)
|
||||
if (check_extensions(device))
|
||||
{
|
||||
physical_device = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
physical_device.getProperties(&physical_device_props);
|
||||
printf("Vulkan: Using device \"%s\"\n", (const char *)physical_device_props.deviceName);
|
||||
|
||||
graphics_queue_family_index = UINT32_MAX;
|
||||
auto queue_props = physical_device.getQueueFamilyProperties();
|
||||
for (size_t i = 0; i < queue_props.size(); i++)
|
||||
{
|
||||
if (queue_props[i].queueFlags & vk::QueueFlagBits::eGraphics)
|
||||
{
|
||||
graphics_queue_family_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (graphics_queue_family_index == UINT32_MAX)
|
||||
return false;
|
||||
|
||||
std::vector<const char *> extension_names = { VK_KHR_SWAPCHAIN_EXTENSION_NAME };
|
||||
std::vector<float> priorities { 1.0f };
|
||||
vk::DeviceQueueCreateInfo dqci({}, graphics_queue_family_index, priorities);
|
||||
vk::DeviceCreateInfo dci({}, dqci, {}, extension_names, {});
|
||||
device = physical_device.createDevice(dci);
|
||||
vk::DeviceQueueCreateInfo dqci({}, graphics_queue_family_index, 1);
|
||||
vk::DeviceCreateInfo dci({}, dqci, {}, required_extensions, {});
|
||||
device = physical_device.createDevice(dci).value;
|
||||
queue = device.getQueue(graphics_queue_family_index, 0);
|
||||
|
||||
auto surface_formats = physical_device.getSurfaceFormatsKHR(surface.get());
|
||||
auto surface_formats = physical_device.getSurfaceFormatsKHR(surface.get()).value;
|
||||
auto format = std::find_if(surface_formats.begin(), surface_formats.end(), [](vk::SurfaceFormatKHR &f) {
|
||||
return (f.format == vk::Format::eB8G8R8A8Unorm);
|
||||
});
|
||||
|
@ -253,7 +262,7 @@ bool Context::init_vma()
|
|||
.setInstance(instance.get())
|
||||
.setPhysicalDevice(physical_device)
|
||||
.setPVulkanFunctions(&vulkan_functions);
|
||||
allocator = vma::createAllocator(allocator_create_info);
|
||||
allocator = vma::createAllocator(allocator_create_info).value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -279,7 +288,7 @@ void Context::wait_idle()
|
|||
vk::CommandBuffer Context::begin_cmd_buffer()
|
||||
{
|
||||
vk::CommandBufferAllocateInfo command_buffer_allocate_info(command_pool.get(), vk::CommandBufferLevel::ePrimary, 1);
|
||||
auto command_buffer = device.allocateCommandBuffers(command_buffer_allocate_info);
|
||||
auto command_buffer = device.allocateCommandBuffers(command_buffer_allocate_info).value;
|
||||
one_time_use_cmd = command_buffer[0];
|
||||
one_time_use_cmd.begin({ vk::CommandBufferUsageFlagBits::eOneTimeSubmit });
|
||||
return one_time_use_cmd;
|
||||
|
@ -305,4 +314,4 @@ void Context::end_cmd_buffer()
|
|||
one_time_use_cmd = nullptr;
|
||||
}
|
||||
|
||||
} // namespace Vulkan
|
||||
} // namespace Vulkan
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
#undef WINVER
|
||||
#define WINVER 0x599
|
||||
#endif
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include "vulkan/vulkan_hpp_wrapper.hpp"
|
||||
#include "../external/VulkanMemoryAllocator-Hpp/include/vk_mem_alloc.hpp"
|
||||
#include "vulkan_swapchain.hpp"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Vulkan
|
||||
{
|
||||
|
@ -32,7 +30,7 @@ class Context
|
|||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
bool init_win32(HINSTANCE hinstance, HWND hwnd, int preferred_device = -1);
|
||||
#endif
|
||||
bool init(int preferred_device = -1);
|
||||
bool init(int preferred_device = -1, int initial_width = -1, int initial_height = -1);
|
||||
bool create_swapchain(int width = -1, int height = -1);
|
||||
bool recreate_swapchain(int width = -1, int height = -1);
|
||||
void wait_idle();
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "vulkan/vulkan.hpp"
|
||||
#include "vulkan_hpp_wrapper.hpp"
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#define VULKAN_HPP_ASSERT(x)
|
||||
#include "vulkan/vulkan.hpp"
|
|
@ -229,7 +229,7 @@ void PipelineImage::create(int width, int height, vk::Format fmt, vk::RenderPass
|
|||
.setSamples(vk::SampleCountFlagBits::e1)
|
||||
.setSharingMode(vk::SharingMode::eExclusive);
|
||||
|
||||
std::tie(image, image_allocation) = allocator.createImage(image_create_info, allocation_create_info);
|
||||
std::tie(image, image_allocation) = allocator.createImage(image_create_info, allocation_create_info).value;
|
||||
|
||||
auto subresource_range = vk::ImageSubresourceRange{}
|
||||
.setAspectMask(vk::ImageAspectFlagBits::eColor)
|
||||
|
@ -245,10 +245,10 @@ void PipelineImage::create(int width, int height, vk::Format fmt, vk::RenderPass
|
|||
.setComponents(vk::ComponentMapping())
|
||||
.setSubresourceRange(subresource_range);
|
||||
|
||||
image_view = device.createImageView(image_view_create_info);
|
||||
image_view = device.createImageView(image_view_create_info).value;
|
||||
|
||||
image_view_create_info.setSubresourceRange(vk::ImageSubresourceRange(vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1));
|
||||
mipless_view = device.createImageView(image_view_create_info);
|
||||
mipless_view = device.createImageView(image_view_create_info).value;
|
||||
|
||||
image_width = width;
|
||||
image_height = height;
|
||||
|
@ -260,7 +260,7 @@ void PipelineImage::create(int width, int height, vk::Format fmt, vk::RenderPass
|
|||
.setRenderPass(renderpass)
|
||||
.setLayers(1);
|
||||
|
||||
framebuffer = device.createFramebufferUnique(framebuffer_create_info);
|
||||
framebuffer = device.createFramebufferUnique(framebuffer_create_info).value;
|
||||
}
|
||||
|
||||
} // namespace Vulkan
|
|
@ -40,7 +40,7 @@ void ShaderChain::construct_buffer_objects()
|
|||
uint8_t *ubo_memory = nullptr;
|
||||
|
||||
if (pipeline.shader->ubo_size > 0)
|
||||
ubo_memory = (uint8_t *)context->allocator.mapMemory(pipeline.uniform_buffer_allocation);
|
||||
ubo_memory = (uint8_t *)context->allocator.mapMemory(pipeline.uniform_buffer_allocation).value;
|
||||
|
||||
for (auto &uniform : pipeline.shader->uniforms)
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ bool ShaderChain::load_shader_preset(std::string filename)
|
|||
.setMaxSets(pipelines.size() * queue_size)
|
||||
.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
|
||||
|
||||
descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info);
|
||||
descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info).value;
|
||||
|
||||
for (auto &p : pipelines)
|
||||
p->generate_frame_resources(descriptor_pool.get());
|
||||
|
@ -267,9 +267,9 @@ bool ShaderChain::load_shader_preset(std::string filename)
|
|||
.setFlags(vma::AllocationCreateFlagBits::eHostAccessSequentialWrite)
|
||||
.setRequiredFlags(vk::MemoryPropertyFlagBits::eHostVisible);
|
||||
|
||||
std::tie(vertex_buffer, vertex_buffer_allocation) = context->allocator.createBuffer(buffer_create_info, allocation_create_info);
|
||||
std::tie(vertex_buffer, vertex_buffer_allocation) = context->allocator.createBuffer(buffer_create_info, allocation_create_info).value;
|
||||
|
||||
auto vertex_buffer_memory = context->allocator.mapMemory(vertex_buffer_allocation);
|
||||
auto vertex_buffer_memory = context->allocator.mapMemory(vertex_buffer_allocation).value;
|
||||
memcpy(vertex_buffer_memory, vertex_data, sizeof(vertex_data));
|
||||
context->allocator.unmapMemory(vertex_buffer_allocation);
|
||||
context->allocator.flushAllocation(vertex_buffer_allocation, 0, sizeof(vertex_data));
|
||||
|
|
|
@ -62,7 +62,7 @@ void SimpleOutput::create_objects()
|
|||
.setDescriptorPool(context->descriptor_pool.get())
|
||||
.setDescriptorSetCount(1)
|
||||
.setSetLayouts(descriptor_set_layout.get());
|
||||
auto descriptor = device.allocateDescriptorSetsUnique(dsai);
|
||||
auto descriptor = device.allocateDescriptorSetsUnique(dsai).value;
|
||||
descriptors.push_back(std::move(descriptor[0]));
|
||||
}
|
||||
|
||||
|
@ -87,11 +87,11 @@ void SimpleOutput::create_objects()
|
|||
.setMaxLod(1.0f)
|
||||
.setMipLodBias(0.0)
|
||||
.setCompareEnable(false);
|
||||
linear_sampler = device.createSampler(sci);
|
||||
linear_sampler = device.createSampler(sci).value;
|
||||
|
||||
sci.setMinFilter(vk::Filter::eNearest)
|
||||
.setMagFilter(vk::Filter::eNearest);
|
||||
nearest_sampler = device.createSampler(sci);
|
||||
nearest_sampler = device.createSampler(sci).value;
|
||||
}
|
||||
|
||||
void SimpleOutput::create_pipeline()
|
||||
|
@ -99,8 +99,8 @@ void SimpleOutput::create_pipeline()
|
|||
auto vertex_spirv = SlangShader::generate_spirv(vertex_shader, "vertex");
|
||||
auto fragment_spirv = SlangShader::generate_spirv(fragment_shader, "fragment");
|
||||
|
||||
auto vertex_module = device.createShaderModuleUnique({ {}, vertex_spirv });
|
||||
auto fragment_module = device.createShaderModuleUnique({ {}, fragment_spirv });
|
||||
auto vertex_module = device.createShaderModuleUnique({ {}, vertex_spirv }).value;
|
||||
auto fragment_module = device.createShaderModuleUnique({ {}, fragment_spirv }).value;
|
||||
|
||||
vk::PipelineShaderStageCreateInfo vertex_ci;
|
||||
vertex_ci.setStage(vk::ShaderStageFlagBits::eVertex)
|
||||
|
@ -182,14 +182,14 @@ void SimpleOutput::create_pipeline()
|
|||
.setDescriptorType(vk::DescriptorType::eCombinedImageSampler);
|
||||
vk::DescriptorSetLayoutCreateInfo dslci{};
|
||||
dslci.setBindings(dslb);
|
||||
descriptor_set_layout = device.createDescriptorSetLayoutUnique(dslci);
|
||||
descriptor_set_layout = device.createDescriptorSetLayoutUnique(dslci).value;
|
||||
|
||||
vk::PipelineLayoutCreateInfo pipeline_layout_info;
|
||||
pipeline_layout_info.setSetLayoutCount(0)
|
||||
.setPushConstantRangeCount(0)
|
||||
.setSetLayouts(descriptor_set_layout.get());
|
||||
|
||||
pipeline_layout = device.createPipelineLayoutUnique(pipeline_layout_info);
|
||||
pipeline_layout = device.createPipelineLayoutUnique(pipeline_layout_info).value;
|
||||
|
||||
vk::GraphicsPipelineCreateInfo pipeline_create_info;
|
||||
pipeline_create_info.setStageCount(2)
|
||||
|
|
|
@ -156,10 +156,10 @@ bool SlangPipeline::generate_pipeline(bool lastpass)
|
|||
.setDependencies(subpass_dependency)
|
||||
.setAttachments(attachment_description);
|
||||
|
||||
render_pass = device.createRenderPassUnique(render_pass_create_info);
|
||||
render_pass = device.createRenderPassUnique(render_pass_create_info).value;
|
||||
|
||||
auto vertex_module = device.createShaderModuleUnique({ {}, shader->vertex_shader_spirv });
|
||||
auto fragment_module = device.createShaderModuleUnique({ {}, shader->fragment_shader_spirv });
|
||||
auto vertex_module = device.createShaderModuleUnique({ {}, shader->vertex_shader_spirv }).value;
|
||||
auto fragment_module = device.createShaderModuleUnique({ {}, shader->fragment_shader_spirv }).value;
|
||||
|
||||
auto vertex_ci = vk::PipelineShaderStageCreateInfo{}
|
||||
.setStage(vk::ShaderStageFlagBits::eVertex)
|
||||
|
@ -278,7 +278,7 @@ bool SlangPipeline::generate_pipeline(bool lastpass)
|
|||
|
||||
auto dslci = vk::DescriptorSetLayoutCreateInfo{}
|
||||
.setBindings(descriptor_set_layout_bindings);
|
||||
descriptor_set_layout = device.createDescriptorSetLayoutUnique(dslci);
|
||||
descriptor_set_layout = device.createDescriptorSetLayoutUnique(dslci).value;
|
||||
|
||||
vk::PushConstantRange pcr(vk::ShaderStageFlagBits::eAllGraphics, 0, shader->push_constant_block_size);
|
||||
|
||||
|
@ -289,7 +289,7 @@ bool SlangPipeline::generate_pipeline(bool lastpass)
|
|||
if (shader->push_constant_block_size > 0)
|
||||
pipeline_layout_info.setPushConstantRanges(pcr);
|
||||
|
||||
pipeline_layout = device.createPipelineLayoutUnique(pipeline_layout_info);
|
||||
pipeline_layout = device.createPipelineLayoutUnique(pipeline_layout_info).value;
|
||||
|
||||
auto pipeline_create_info = vk::GraphicsPipelineCreateInfo{}
|
||||
.setStageCount(2)
|
||||
|
@ -343,11 +343,11 @@ bool SlangPipeline::generate_frame_resources(vk::DescriptorPool pool)
|
|||
|
||||
vk::DescriptorSetAllocateInfo descriptor_set_allocate_info(pool, descriptor_set_layout.get());
|
||||
|
||||
auto result = device.allocateDescriptorSetsUnique(descriptor_set_allocate_info);
|
||||
auto result = device.allocateDescriptorSetsUnique(descriptor_set_allocate_info).value;
|
||||
f.descriptor_set = std::move(result[0]);
|
||||
}
|
||||
|
||||
semaphore = device.createSemaphoreUnique({});
|
||||
semaphore = device.createSemaphoreUnique({}).value;
|
||||
|
||||
push_constants.resize(shader->push_constant_block_size);
|
||||
|
||||
|
@ -361,7 +361,7 @@ bool SlangPipeline::generate_frame_resources(vk::DescriptorPool pool)
|
|||
.setFlags(vma::AllocationCreateFlagBits::eHostAccessSequentialWrite)
|
||||
.setRequiredFlags(vk::MemoryPropertyFlagBits::eHostVisible);
|
||||
|
||||
std::tie(uniform_buffer, uniform_buffer_allocation) = context->allocator.createBuffer(buffer_create_info, allocation_create_info);
|
||||
std::tie(uniform_buffer, uniform_buffer_allocation) = context->allocator.createBuffer(buffer_create_info, allocation_create_info).value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ bool SlangPipeline::generate_frame_resources(vk::DescriptorPool pool)
|
|||
.setMaxLod(VK_LOD_CLAMP_NONE)
|
||||
.setAnisotropyEnable(false);
|
||||
|
||||
sampler = device.createSamplerUnique(sampler_create_info);
|
||||
sampler = device.createSamplerUnique(sampler_create_info).value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include "vulkan/vulkan_hpp_wrapper.hpp"
|
||||
#include "slang_shader.hpp"
|
||||
#include "vulkan_context.hpp"
|
||||
#include "vulkan_pipeline_image.hpp"
|
||||
|
|
|
@ -75,7 +75,7 @@ void Swapchain::create_render_pass()
|
|||
.setDependencies(subpass_dependency)
|
||||
.setAttachments(attachment_description);
|
||||
|
||||
render_pass = device.createRenderPassUnique(render_pass_create_info);
|
||||
render_pass = device.createRenderPassUnique(render_pass_create_info).value;
|
||||
}
|
||||
|
||||
bool Swapchain::recreate(int new_width, int new_height)
|
||||
|
@ -95,7 +95,7 @@ bool Swapchain::check_and_resize(int width, int height)
|
|||
|
||||
if (width == -1 && height == -1)
|
||||
{
|
||||
surface_capabilities = physical_device.getSurfaceCapabilitiesKHR(surface);
|
||||
surface_capabilities = physical_device.getSurfaceCapabilitiesKHR(surface).value;
|
||||
width = surface_capabilities.currentExtent.width;
|
||||
height = surface_capabilities.currentExtent.height;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
frames.clear();
|
||||
imageviewfbs.clear();
|
||||
|
||||
auto surface_capabilities = physical_device.getSurfaceCapabilitiesKHR(surface);
|
||||
auto surface_capabilities = physical_device.getSurfaceCapabilitiesKHR(surface).value;
|
||||
|
||||
if (surface_capabilities.minImageCount > desired_num_swapchain_images)
|
||||
num_swapchain_images = surface_capabilities.minImageCount;
|
||||
|
@ -163,7 +163,7 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
if (extents.height < surface_capabilities.minImageExtent.height)
|
||||
extents.height = surface_capabilities.minImageExtent.height;
|
||||
|
||||
auto present_modes = physical_device.getSurfacePresentModesKHR(surface);
|
||||
auto present_modes = physical_device.getSurfacePresentModesKHR(surface).value;
|
||||
auto tearing_present_mode = vk::PresentModeKHR::eFifo;
|
||||
if (std::find(present_modes.begin(), present_modes.end(), vk::PresentModeKHR::eImmediate) != present_modes.end())
|
||||
tearing_present_mode = vk::PresentModeKHR::eImmediate;
|
||||
|
@ -189,7 +189,7 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
swapchain_create_info.setOldSwapchain(swapchain_object.get());
|
||||
|
||||
try {
|
||||
swapchain_object = device.createSwapchainKHRUnique(swapchain_create_info);
|
||||
swapchain_object = device.createSwapchainKHRUnique(swapchain_create_info).value;
|
||||
} catch (std::exception &e) {
|
||||
swapchain_object.reset();
|
||||
}
|
||||
|
@ -197,9 +197,9 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
if (!swapchain_object)
|
||||
return false;
|
||||
|
||||
auto swapchain_images = device.getSwapchainImagesKHR(swapchain_object.get());
|
||||
auto swapchain_images = device.getSwapchainImagesKHR(swapchain_object.get()).value;
|
||||
vk::CommandBufferAllocateInfo command_buffer_allocate_info(command_pool, vk::CommandBufferLevel::ePrimary, swapchain_images.size());
|
||||
auto command_buffers = device.allocateCommandBuffersUnique(command_buffer_allocate_info);
|
||||
auto command_buffers = device.allocateCommandBuffersUnique(command_buffer_allocate_info).value;
|
||||
|
||||
if (imageviewfbs.size() > num_swapchain_images)
|
||||
num_swapchain_images = imageviewfbs.size();
|
||||
|
@ -214,9 +214,9 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
// Create frame queue resources
|
||||
auto &frame = frames[i];
|
||||
frame.command_buffer = std::move(command_buffers[i]);
|
||||
frame.fence = device.createFenceUnique(fence_create_info);
|
||||
frame.acquire = device.createSemaphoreUnique({});
|
||||
frame.complete = device.createSemaphoreUnique({});
|
||||
frame.fence = device.createFenceUnique(fence_create_info).value;
|
||||
frame.acquire = device.createSemaphoreUnique({}).value;
|
||||
frame.complete = device.createSemaphoreUnique({}).value;
|
||||
}
|
||||
current_frame = 0;
|
||||
|
||||
|
@ -231,7 +231,7 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
.setFormat(vk::Format::eB8G8R8A8Unorm)
|
||||
.setComponents(vk::ComponentMapping())
|
||||
.setSubresourceRange(vk::ImageSubresourceRange(vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1));
|
||||
image.image_view = device.createImageViewUnique(image_view_create_info);
|
||||
image.image_view = device.createImageViewUnique(image_view_create_info).value;
|
||||
|
||||
auto framebuffer_create_info = vk::FramebufferCreateInfo{}
|
||||
.setAttachments(image.image_view.get())
|
||||
|
@ -239,7 +239,7 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
.setHeight(extents.height)
|
||||
.setLayers(1)
|
||||
.setRenderPass(render_pass.get());
|
||||
image.framebuffer = device.createFramebufferUnique(framebuffer_create_info);
|
||||
image.framebuffer = device.createFramebufferUnique(framebuffer_create_info).value;
|
||||
}
|
||||
|
||||
device.waitIdle();
|
||||
|
@ -267,12 +267,8 @@ bool Swapchain::begin_frame()
|
|||
}
|
||||
|
||||
vk::ResultValue<uint32_t> result_value(vk::Result::eSuccess, 0);
|
||||
try {
|
||||
result_value = device.acquireNextImageKHR(swapchain_object.get(), UINT64_MAX, frame.acquire.get());
|
||||
} catch (vk::OutOfDateKHRError &e) {
|
||||
result_value.result = vk::Result::eErrorOutOfDateKHR;
|
||||
}
|
||||
|
||||
result_value = device.acquireNextImageKHR(swapchain_object.get(), UINT64_MAX, frame.acquire.get());
|
||||
|
||||
if (result_value.result == vk::Result::eErrorOutOfDateKHR ||
|
||||
result_value.result == vk::Result::eSuboptimalKHR)
|
||||
{
|
||||
|
@ -325,14 +321,12 @@ bool Swapchain::swap()
|
|||
.setImageIndices(current_swapchain_image);
|
||||
|
||||
vk::Result result = vk::Result::eSuccess;
|
||||
try {
|
||||
result = queue.presentKHR(present_info);
|
||||
} catch (vk::OutOfDateKHRError &e) {
|
||||
result = queue.presentKHR(present_info);
|
||||
if (result == vk::Result::eErrorOutOfDateKHR)
|
||||
{
|
||||
// NVIDIA binary drivers will set OutOfDate between acquire and
|
||||
// present. Ignore this and fix it on the next swapchain acquire.
|
||||
} catch (std::exception &e) {
|
||||
printf("%s\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
current_frame = (current_frame + 1) % num_swapchain_images;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include "vulkan/vulkan_handles.hpp"
|
||||
#include "vulkan/vulkan_structs.hpp"
|
||||
#include "vulkan/vulkan_hpp_wrapper.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace Vulkan
|
||||
|
|
|
@ -91,7 +91,7 @@ void Texture::from_buffer(vk::CommandBuffer cmd,
|
|||
byte_stride = pixel_size * width;
|
||||
}
|
||||
|
||||
auto map = allocator.mapMemory(buffer_allocation);
|
||||
auto map = allocator.mapMemory(buffer_allocation).value;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
auto src = buffer + byte_stride * y;
|
||||
|
@ -206,7 +206,7 @@ void Texture::from_buffer(vk::CommandBuffer cmd,
|
|||
void Texture::from_buffer(uint8_t *buffer, int width, int height, int byte_stride)
|
||||
{
|
||||
vk::CommandBufferAllocateInfo cbai(command_pool, vk::CommandBufferLevel::ePrimary, 1);
|
||||
auto command_buffer_vector = device.allocateCommandBuffersUnique(cbai);
|
||||
auto command_buffer_vector = device.allocateCommandBuffersUnique(cbai).value;
|
||||
auto &cmd = command_buffer_vector[0];
|
||||
cmd->begin({ vk::CommandBufferUsageFlagBits::eOneTimeSubmit });
|
||||
from_buffer(cmd.get(), buffer, width, height, byte_stride);
|
||||
|
@ -241,7 +241,7 @@ void Texture::create(int width, int height, vk::Format fmt, vk::SamplerAddressMo
|
|||
.setSamples(vk::SampleCountFlagBits::e1)
|
||||
.setSharingMode(vk::SharingMode::eExclusive);
|
||||
|
||||
std::tie(image, image_allocation) = allocator.createImage(ici, aci);
|
||||
std::tie(image, image_allocation) = allocator.createImage(ici, aci).value;
|
||||
|
||||
buffer_size = width * height * 4;
|
||||
if (format == vk::Format::eR5G6B5UnormPack16)
|
||||
|
@ -254,7 +254,7 @@ void Texture::create(int width, int height, vk::Format fmt, vk::SamplerAddressMo
|
|||
.setFlags(vma::AllocationCreateFlagBits::eHostAccessSequentialWrite)
|
||||
.setUsage(vma::MemoryUsage::eAutoPreferHost);
|
||||
|
||||
std::tie(buffer, buffer_allocation) = allocator.createBuffer(bci, aci);
|
||||
std::tie(buffer, buffer_allocation) = allocator.createBuffer(bci, aci).value;
|
||||
|
||||
auto isrr = vk::ImageSubresourceRange{}
|
||||
.setAspectMask(vk::ImageAspectFlagBits::eColor)
|
||||
|
@ -269,7 +269,7 @@ void Texture::create(int width, int height, vk::Format fmt, vk::SamplerAddressMo
|
|||
.setComponents(vk::ComponentMapping())
|
||||
.setSubresourceRange(isrr);
|
||||
|
||||
image_view = device.createImageView(ivci);
|
||||
image_view = device.createImageView(ivci).value;
|
||||
|
||||
image_width = width;
|
||||
image_height = height;
|
||||
|
@ -293,7 +293,7 @@ void Texture::create(int width, int height, vk::Format fmt, vk::SamplerAddressMo
|
|||
.setMaxLod(10000.0f)
|
||||
.setMipmapMode(vk::SamplerMipmapMode::eLinear);
|
||||
|
||||
sampler = device.createSampler(sampler_create_info);
|
||||
sampler = device.createSampler(sampler_create_info).value;
|
||||
}
|
||||
|
||||
void Texture::discard_staging_buffer()
|
||||
|
|
|
@ -29,7 +29,7 @@ bool CVulkan::InitImGui()
|
|||
.setPoolSizes(pool_sizes)
|
||||
.setMaxSets(1000)
|
||||
.setFlags(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet);
|
||||
imgui_descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info);
|
||||
imgui_descriptor_pool = context->device.createDescriptorPoolUnique(descriptor_pool_create_info).value;
|
||||
|
||||
ImGui_ImplVulkan_InitInfo init_info{};
|
||||
init_info.Instance = context->instance.get();
|
||||
|
@ -286,4 +286,4 @@ std::function<void(const char *)> CVulkan::GetShaderParametersSaveFunction()
|
|||
if (shaderchain)
|
||||
shaderchain->preset->save_to_file(filename);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VULKAN_HPP_NO_EXCEPTIONS=1;VULKAN_HPP_NO_NODISCARD_WARNINGS=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<PrecompiledHeader />
|
||||
|
@ -169,7 +169,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;D3D_DEBUG_INFO;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VULKAN_HPP_NO_EXCEPTIONS=1;VULKAN_HPP_NO_NODISCARD_WARNINGS=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<PrecompiledHeader />
|
||||
|
@ -225,7 +225,7 @@
|
|||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VULKAN_HPP_NO_EXCEPTIONS=1;VULKAN_HPP_NO_NODISCARD_WARNINGS=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
|
@ -280,7 +280,7 @@
|
|||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\;$(ProjectDir)..\..\;$(ProjectDir)zlib\src;$(ProjectDir)..\unzip;$(ProjectDir)libpng\src;$(ProjectDir)..\apu\bapu;$(ProjectDir)..\external\glslang;$(ProjectDir)..\external\stb;$(ProjectDir)..\external\vulkan-headers\include;$(ProjectDir)..\external\VulkanMemoryAllocator-Hpp\include;$(ProjectDir)..\external\fmt\include;$(ProjectDir)..\external\imgui</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;ALLOW_CPU_OVERCLOCK;HAVE_LIBPNG;JMA_SUPPORT;ZLIB;UNZIP_SUPPORT;__WIN32__;NETPLAY_SUPPORT;DIRECTDRAW_SUPPORT;USE_SLANG;%(PreprocessorDefinitions);VK_USE_PLATFORM_WIN32_KHR;VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1;VULKAN_HPP_NO_EXCEPTIONS=1;VULKAN_HPP_NO_NODISCARD_WARNINGS=1;VMA_DYNAMIC_VULKAN_FUNCTIONS=1;VMA_STATIC_VULKAN_FUNCTIONS=0;VMA_USE_STL_SHARED_MUTEX=0;IMGUI_IMPL_VULKAN_NO_PROTOTYPES</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
|
@ -708,4 +708,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue