Add GetDevice function instead of accessing device member directly

This commit is contained in:
Magnus Norddahl 2023-04-16 17:07:55 +02:00 committed by Christoph Oelckers
parent 3551e1e5e9
commit 9caa966f6f
16 changed files with 140 additions and 140 deletions

View file

@ -28,7 +28,7 @@
VkRaytrace::VkRaytrace(VulkanRenderDevice* fb) : fb(fb) VkRaytrace::VkRaytrace(VulkanRenderDevice* fb) : fb(fb)
{ {
useRayQuery = fb->device->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME); useRayQuery = fb->GetDevice()->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME);
NullMesh.MeshVertices.Push({ -1.0f, -1.0f, -1.0f }); NullMesh.MeshVertices.Push({ -1.0f, -1.0f, -1.0f });
NullMesh.MeshVertices.Push({ 1.0f, -1.0f, -1.0f }); NullMesh.MeshVertices.Push({ 1.0f, -1.0f, -1.0f });
@ -113,7 +113,7 @@ void VkRaytrace::CreateVertexAndIndexBuffers()
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)
.Size(vertices.size() * sizeof(FVector4)) .Size(vertices.size() * sizeof(FVector4))
.DebugName("vertexBuffer") .DebugName("vertexBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
indexBuffer = BufferBuilder() indexBuffer = BufferBuilder()
.Usage( .Usage(
@ -125,19 +125,19 @@ void VkRaytrace::CreateVertexAndIndexBuffers()
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)
.Size((size_t)Mesh->MeshElements.Size() * sizeof(uint32_t)) .Size((size_t)Mesh->MeshElements.Size() * sizeof(uint32_t))
.DebugName("indexBuffer") .DebugName("indexBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
nodesBuffer = BufferBuilder() nodesBuffer = BufferBuilder()
.Usage(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT) .Usage(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT)
.Size(sizeof(CollisionNodeBufferHeader) + nodes.size() * sizeof(CollisionNode)) .Size(sizeof(CollisionNodeBufferHeader) + nodes.size() * sizeof(CollisionNode))
.DebugName("nodesBuffer") .DebugName("nodesBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
transferBuffer = BufferTransfer() transferBuffer = BufferTransfer()
.AddBuffer(vertexBuffer.get(), vertices.data(), vertices.size() * sizeof(FVector4)) .AddBuffer(vertexBuffer.get(), vertices.data(), vertices.size() * sizeof(FVector4))
.AddBuffer(indexBuffer.get(), Mesh->MeshElements.Data(), (size_t)Mesh->MeshElements.Size() * sizeof(uint32_t)) .AddBuffer(indexBuffer.get(), Mesh->MeshElements.Data(), (size_t)Mesh->MeshElements.Size() * sizeof(uint32_t))
.AddBuffer(nodesBuffer.get(), &nodesHeader, sizeof(CollisionNodeBufferHeader), nodes.data(), nodes.size() * sizeof(CollisionNode)) .AddBuffer(nodesBuffer.get(), &nodesHeader, sizeof(CollisionNodeBufferHeader), nodes.data(), nodes.size() * sizeof(CollisionNode))
.Execute(fb->device.get(), fb->GetCommands()->GetTransferCommands()); .Execute(fb->GetDevice(), fb->GetCommands()->GetTransferCommands());
PipelineBarrier() PipelineBarrier()
.AddMemory(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT) .AddMemory(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT)
@ -171,25 +171,26 @@ void VkRaytrace::CreateBottomLevelAccelerationStructure()
uint32_t maxPrimitiveCount = Mesh->MeshElements.Size() / 3; uint32_t maxPrimitiveCount = Mesh->MeshElements.Size() / 3;
VkAccelerationStructureBuildSizesInfoKHR sizeInfo = { VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR }; VkAccelerationStructureBuildSizesInfoKHR sizeInfo = { VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR };
vkGetAccelerationStructureBuildSizesKHR(fb->device->device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &maxPrimitiveCount, &sizeInfo); vkGetAccelerationStructureBuildSizesKHR(fb->GetDevice()->device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &maxPrimitiveCount, &sizeInfo);
blAccelStructBuffer = BufferBuilder() blAccelStructBuffer = BufferBuilder()
.Usage(VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) .Usage(VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)
.Size(sizeInfo.accelerationStructureSize) .Size(sizeInfo.accelerationStructureSize)
.DebugName("blAccelStructBuffer") .DebugName("blAccelStructBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
blAccelStruct = AccelerationStructureBuilder() blAccelStruct = AccelerationStructureBuilder()
.Type(VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR) .Type(VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR)
.Buffer(blAccelStructBuffer.get(), sizeInfo.accelerationStructureSize) .Buffer(blAccelStructBuffer.get(), sizeInfo.accelerationStructureSize)
.DebugName("blAccelStruct") .DebugName("blAccelStruct")
.Create(fb->device.get()); .Create(fb->GetDevice());
blScratchBuffer = BufferBuilder() blScratchBuffer = BufferBuilder()
.Usage(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) .Usage(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)
.Size(sizeInfo.buildScratchSize) .Size(sizeInfo.buildScratchSize)
.MinAlignment(fb->GetDevice()->PhysicalDevice.Properties.AccelerationStructure.minAccelerationStructureScratchOffsetAlignment)
.DebugName("blScratchBuffer") .DebugName("blScratchBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
buildInfo.dstAccelerationStructure = blAccelStruct->accelstruct; buildInfo.dstAccelerationStructure = blAccelStruct->accelstruct;
buildInfo.scratchData.deviceAddress = blScratchBuffer->GetDeviceAddress(); buildInfo.scratchData.deviceAddress = blScratchBuffer->GetDeviceAddress();
@ -217,7 +218,7 @@ void VkRaytrace::CreateTopLevelAccelerationStructure()
.Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY) .Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY)
.Size(sizeof(VkAccelerationStructureInstanceKHR)) .Size(sizeof(VkAccelerationStructureInstanceKHR))
.DebugName("tlTransferBuffer") .DebugName("tlTransferBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
auto data = (uint8_t*)tlTransferBuffer->Map(0, sizeof(VkAccelerationStructureInstanceKHR)); auto data = (uint8_t*)tlTransferBuffer->Map(0, sizeof(VkAccelerationStructureInstanceKHR));
memcpy(data, &instance, sizeof(VkAccelerationStructureInstanceKHR)); memcpy(data, &instance, sizeof(VkAccelerationStructureInstanceKHR));
@ -227,7 +228,7 @@ void VkRaytrace::CreateTopLevelAccelerationStructure()
.Usage(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR | VK_BUFFER_USAGE_TRANSFER_DST_BIT) .Usage(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR | VK_BUFFER_USAGE_TRANSFER_DST_BIT)
.Size(sizeof(VkAccelerationStructureInstanceKHR)) .Size(sizeof(VkAccelerationStructureInstanceKHR))
.DebugName("tlInstanceBuffer") .DebugName("tlInstanceBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
fb->GetCommands()->GetTransferCommands()->copyBuffer(tlTransferBuffer.get(), tlInstanceBuffer.get()); fb->GetCommands()->GetTransferCommands()->copyBuffer(tlTransferBuffer.get(), tlInstanceBuffer.get());
@ -255,25 +256,26 @@ void VkRaytrace::CreateTopLevelAccelerationStructure()
uint32_t maxInstanceCount = 1; uint32_t maxInstanceCount = 1;
VkAccelerationStructureBuildSizesInfoKHR sizeInfo = { VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR }; VkAccelerationStructureBuildSizesInfoKHR sizeInfo = { VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR };
vkGetAccelerationStructureBuildSizesKHR(fb->device->device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &maxInstanceCount, &sizeInfo); vkGetAccelerationStructureBuildSizesKHR(fb->GetDevice()->device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &maxInstanceCount, &sizeInfo);
tlAccelStructBuffer = BufferBuilder() tlAccelStructBuffer = BufferBuilder()
.Usage(VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT) .Usage(VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT)
.Size(sizeInfo.accelerationStructureSize) .Size(sizeInfo.accelerationStructureSize)
.DebugName("tlAccelStructBuffer") .DebugName("tlAccelStructBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
tlAccelStruct = AccelerationStructureBuilder() tlAccelStruct = AccelerationStructureBuilder()
.Type(VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR) .Type(VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR)
.Buffer(tlAccelStructBuffer.get(), sizeInfo.accelerationStructureSize) .Buffer(tlAccelStructBuffer.get(), sizeInfo.accelerationStructureSize)
.DebugName("tlAccelStruct") .DebugName("tlAccelStruct")
.Create(fb->device.get()); .Create(fb->GetDevice());
tlScratchBuffer = BufferBuilder() tlScratchBuffer = BufferBuilder()
.Usage(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) .Usage(VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)
.Size(sizeInfo.buildScratchSize) .Size(sizeInfo.buildScratchSize)
.MinAlignment(fb->GetDevice()->PhysicalDevice.Properties.AccelerationStructure.minAccelerationStructureScratchOffsetAlignment)
.DebugName("tlScratchBuffer") .DebugName("tlScratchBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
buildInfo.dstAccelerationStructure = tlAccelStruct->accelstruct; buildInfo.dstAccelerationStructure = tlAccelStruct->accelstruct;
buildInfo.scratchData.deviceAddress = tlScratchBuffer->GetDeviceAddress(); buildInfo.scratchData.deviceAddress = tlScratchBuffer->GetDeviceAddress();

View file

@ -80,13 +80,13 @@ void VkHardwareBuffer::SetData(size_t size, const void *data, BufferUsageType us
.Usage(VK_BUFFER_USAGE_TRANSFER_DST_BIT | mBufferType, VMA_MEMORY_USAGE_GPU_ONLY) .Usage(VK_BUFFER_USAGE_TRANSFER_DST_BIT | mBufferType, VMA_MEMORY_USAGE_GPU_ONLY)
.Size(bufsize) .Size(bufsize)
.DebugName(usage == BufferUsageType::Static ? "VkHardwareBuffer.Static" : "VkHardwareBuffer.Stream") .DebugName(usage == BufferUsageType::Static ? "VkHardwareBuffer.Static" : "VkHardwareBuffer.Stream")
.Create(fb->device.get()); .Create(fb->GetDevice());
mStaging = BufferBuilder() mStaging = BufferBuilder()
.Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY) .Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY)
.Size(bufsize) .Size(bufsize)
.DebugName(usage == BufferUsageType::Static ? "VkHardwareBuffer.Staging.Static" : "VkHardwareBuffer.Staging.Stream") .DebugName(usage == BufferUsageType::Static ? "VkHardwareBuffer.Staging.Static" : "VkHardwareBuffer.Staging.Stream")
.Create(fb->device.get()); .Create(fb->GetDevice());
if (data) if (data)
{ {
@ -108,7 +108,7 @@ void VkHardwareBuffer::SetData(size_t size, const void *data, BufferUsageType us
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
.Size(bufsize) .Size(bufsize)
.DebugName("VkHardwareBuffer.Persistent") .DebugName("VkHardwareBuffer.Persistent")
.Create(fb->device.get()); .Create(fb->GetDevice());
map = mBuffer->Map(0, bufsize); map = mBuffer->Map(0, bufsize);
if (data) if (data)
@ -125,7 +125,7 @@ void VkHardwareBuffer::SetData(size_t size, const void *data, BufferUsageType us
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
.Size(bufsize) .Size(bufsize)
.DebugName("VkHardwareBuffer.Mappable") .DebugName("VkHardwareBuffer.Mappable")
.Create(fb->device.get()); .Create(fb->GetDevice());
if (data) if (data)
{ {
@ -176,7 +176,7 @@ void VkHardwareBuffer::Resize(size_t newsize)
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
.Size(newsize) .Size(newsize)
.DebugName("VkHardwareBuffer.Resized") .DebugName("VkHardwareBuffer.Resized")
.Create(fb->device.get()); .Create(fb->GetDevice());
buffersize = newsize; buffersize = newsize;
// Transfer data from old to new // Transfer data from old to new

View file

@ -40,24 +40,24 @@ extern FString gpuStatOutput;
VkCommandBufferManager::VkCommandBufferManager(VulkanRenderDevice* fb) : fb(fb) VkCommandBufferManager::VkCommandBufferManager(VulkanRenderDevice* fb) : fb(fb)
{ {
mCommandPool = CommandPoolBuilder() mCommandPool = CommandPoolBuilder()
.QueueFamily(fb->device->GraphicsFamily) .QueueFamily(fb->GetDevice()->GraphicsFamily)
.DebugName("mCommandPool") .DebugName("mCommandPool")
.Create(fb->device.get()); .Create(fb->GetDevice());
for (auto& semaphore : mSubmitSemaphore) for (auto& semaphore : mSubmitSemaphore)
semaphore.reset(new VulkanSemaphore(fb->device.get())); semaphore.reset(new VulkanSemaphore(fb->GetDevice()));
for (auto& fence : mSubmitFence) for (auto& fence : mSubmitFence)
fence.reset(new VulkanFence(fb->device.get())); fence.reset(new VulkanFence(fb->GetDevice()));
for (int i = 0; i < maxConcurrentSubmitCount; i++) for (int i = 0; i < maxConcurrentSubmitCount; i++)
mSubmitWaitFences[i] = mSubmitFence[i]->fence; mSubmitWaitFences[i] = mSubmitFence[i]->fence;
if (fb->device->GraphicsTimeQueries) if (fb->GetDevice()->GraphicsTimeQueries)
{ {
mTimestampQueryPool = QueryPoolBuilder() mTimestampQueryPool = QueryPoolBuilder()
.QueryType(VK_QUERY_TYPE_TIMESTAMP, MaxTimestampQueries) .QueryType(VK_QUERY_TYPE_TIMESTAMP, MaxTimestampQueries)
.Create(fb->device.get()); .Create(fb->GetDevice());
GetDrawCommands()->resetQueryPool(mTimestampQueryPool.get(), 0, MaxTimestampQueries); GetDrawCommands()->resetQueryPool(mTimestampQueryPool.get(), 0, MaxTimestampQueries);
} }
@ -104,8 +104,8 @@ void VkCommandBufferManager::FlushCommands(VulkanCommandBuffer** commands, size_
if (mNextSubmit >= maxConcurrentSubmitCount) if (mNextSubmit >= maxConcurrentSubmitCount)
{ {
vkWaitForFences(fb->device->device, 1, &mSubmitFence[currentIndex]->fence, VK_TRUE, std::numeric_limits<uint64_t>::max()); vkWaitForFences(fb->GetDevice()->device, 1, &mSubmitFence[currentIndex]->fence, VK_TRUE, std::numeric_limits<uint64_t>::max());
vkResetFences(fb->device->device, 1, &mSubmitFence[currentIndex]->fence); vkResetFences(fb->GetDevice()->device, 1, &mSubmitFence[currentIndex]->fence);
} }
QueueSubmit submit; QueueSubmit submit;
@ -125,7 +125,7 @@ void VkCommandBufferManager::FlushCommands(VulkanCommandBuffer** commands, size_
if (!lastsubmit) if (!lastsubmit)
submit.AddSignal(mSubmitSemaphore[currentIndex].get()); submit.AddSignal(mSubmitSemaphore[currentIndex].get());
submit.Execute(fb->device.get(), fb->device->GraphicsQueue, mSubmitFence[currentIndex].get()); submit.Execute(fb->GetDevice(), fb->GetDevice()->GraphicsQueue, mSubmitFence[currentIndex].get());
mNextSubmit++; mNextSubmit++;
} }
@ -181,8 +181,8 @@ void VkCommandBufferManager::WaitForCommands(bool finish, bool uploadOnly)
if (numWaitFences > 0) if (numWaitFences > 0)
{ {
vkWaitForFences(fb->device->device, numWaitFences, mSubmitWaitFences, VK_TRUE, std::numeric_limits<uint64_t>::max()); vkWaitForFences(fb->GetDevice()->device, numWaitFences, mSubmitWaitFences, VK_TRUE, std::numeric_limits<uint64_t>::max());
vkResetFences(fb->device->device, numWaitFences, mSubmitWaitFences); vkResetFences(fb->GetDevice()->device, numWaitFences, mSubmitWaitFences);
} }
DeleteFrameObjects(uploadOnly); DeleteFrameObjects(uploadOnly);
@ -208,7 +208,7 @@ void VkCommandBufferManager::PushGroup(const FString& name)
if (!gpuStatActive) if (!gpuStatActive)
return; return;
if (mNextTimestampQuery < MaxTimestampQueries && fb->device->GraphicsTimeQueries) if (mNextTimestampQuery < MaxTimestampQueries && fb->GetDevice()->GraphicsTimeQueries)
{ {
TimestampQuery q; TimestampQuery q;
q.name = name; q.name = name;
@ -228,7 +228,7 @@ void VkCommandBufferManager::PopGroup()
TimestampQuery& q = timeElapsedQueries[mGroupStack.back()]; TimestampQuery& q = timeElapsedQueries[mGroupStack.back()];
mGroupStack.pop_back(); mGroupStack.pop_back();
if (mNextTimestampQuery < MaxTimestampQueries && fb->device->GraphicsTimeQueries) if (mNextTimestampQuery < MaxTimestampQueries && fb->GetDevice()->GraphicsTimeQueries)
{ {
q.endIndex = mNextTimestampQuery++; q.endIndex = mNextTimestampQuery++;
GetDrawCommands()->writeTimestamp(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, mTimestampQueryPool.get(), q.endIndex); GetDrawCommands()->writeTimestamp(VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, mTimestampQueryPool.get(), q.endIndex);
@ -241,7 +241,7 @@ void VkCommandBufferManager::UpdateGpuStats()
if (mNextTimestampQuery > 0) if (mNextTimestampQuery > 0)
mTimestampQueryPool->getResults(0, mNextTimestampQuery, sizeof(uint64_t) * mNextTimestampQuery, timestamps, sizeof(uint64_t), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT); mTimestampQueryPool->getResults(0, mNextTimestampQuery, sizeof(uint64_t) * mNextTimestampQuery, timestamps, sizeof(uint64_t), VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
double timestampPeriod = fb->device->PhysicalDevice.Properties.Properties.limits.timestampPeriod; double timestampPeriod = fb->GetDevice()->PhysicalDevice.Properties.Properties.limits.timestampPeriod;
gpuStatOutput = ""; gpuStatOutput = "";
for (auto& q : timeElapsedQueries) for (auto& q : timeElapsedQueries)

View file

@ -86,7 +86,7 @@ void VkDescriptorSetManager::UpdateHWBufferSet()
.AddBuffer(HWBufferSet.get(), 2, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, fb->GetBufferManager()->StreamBuffer->UniformBuffer->mBuffer.get(), 0, sizeof(StreamUBO)) .AddBuffer(HWBufferSet.get(), 2, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, fb->GetBufferManager()->StreamBuffer->UniformBuffer->mBuffer.get(), 0, sizeof(StreamUBO))
.AddBuffer(HWBufferSet.get(), 3, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetBufferManager()->LightBufferSSO->mBuffer.get()) .AddBuffer(HWBufferSet.get(), 3, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetBufferManager()->LightBufferSSO->mBuffer.get())
.AddBuffer(HWBufferSet.get(), 4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetBufferManager()->BoneBufferSSO->mBuffer.get()) .AddBuffer(HWBufferSet.get(), 4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetBufferManager()->BoneBufferSSO->mBuffer.get())
.Execute(fb->device.get()); .Execute(fb->GetDevice());
} }
void VkDescriptorSetManager::UpdateFixedSet() void VkDescriptorSetManager::UpdateFixedSet()
@ -103,7 +103,7 @@ void VkDescriptorSetManager::UpdateFixedSet()
WriteDescriptors update; WriteDescriptors update;
update.AddCombinedImageSampler(FixedSet.get(), 0, fb->GetTextureManager()->Shadowmap.View.get(), fb->GetSamplerManager()->ShadowmapSampler.get(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); update.AddCombinedImageSampler(FixedSet.get(), 0, fb->GetTextureManager()->Shadowmap.View.get(), fb->GetSamplerManager()->ShadowmapSampler.get(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
update.AddCombinedImageSampler(FixedSet.get(), 1, fb->GetTextureManager()->Lightmap.View.get(), fb->GetSamplerManager()->LightmapSampler.get(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); update.AddCombinedImageSampler(FixedSet.get(), 1, fb->GetTextureManager()->Lightmap.View.get(), fb->GetSamplerManager()->LightmapSampler.get(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
if (fb->device->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME)) if (fb->GetDevice()->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME))
{ {
update.AddAccelerationStructure(FixedSet.get(), 2, fb->GetRaytrace()->GetAccelStruct()); update.AddAccelerationStructure(FixedSet.get(), 2, fb->GetRaytrace()->GetAccelStruct());
} }
@ -113,7 +113,7 @@ void VkDescriptorSetManager::UpdateFixedSet()
update.AddBuffer(FixedSet.get(), 3, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetRaytrace()->GetVertexBuffer()); update.AddBuffer(FixedSet.get(), 3, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetRaytrace()->GetVertexBuffer());
update.AddBuffer(FixedSet.get(), 4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetRaytrace()->GetIndexBuffer()); update.AddBuffer(FixedSet.get(), 4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetRaytrace()->GetIndexBuffer());
} }
update.Execute(fb->device.get()); update.Execute(fb->GetDevice());
} }
void VkDescriptorSetManager::ResetHWTextureSets() void VkDescriptorSetManager::ResetHWTextureSets()
@ -144,7 +144,7 @@ VulkanDescriptorSet* VkDescriptorSetManager::GetNullTextureDescriptorSet()
{ {
update.AddCombinedImageSampler(NullTextureDescriptorSet.get(), i, fb->GetTextureManager()->GetNullTextureView(), fb->GetSamplerManager()->Get(CLAMP_XY_NOMIP), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); update.AddCombinedImageSampler(NullTextureDescriptorSet.get(), i, fb->GetTextureManager()->GetNullTextureView(), fb->GetSamplerManager()->Get(CLAMP_XY_NOMIP), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
} }
update.Execute(fb->device.get()); update.Execute(fb->GetDevice());
} }
return NullTextureDescriptorSet.get(); return NullTextureDescriptorSet.get();
@ -161,7 +161,7 @@ std::unique_ptr<VulkanDescriptorSet> VkDescriptorSetManager::AllocateTextureDesc
.AddPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, TextureDescriptorsLeft) .AddPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, TextureDescriptorsLeft)
.MaxSets(TextureDescriptorSetsLeft) .MaxSets(TextureDescriptorSetsLeft)
.DebugName("VkDescriptorSetManager.TextureDescriptorPool") .DebugName("VkDescriptorSetManager.TextureDescriptorPool")
.Create(fb->device.get())); .Create(fb->GetDevice()));
} }
TextureDescriptorSetsLeft--; TextureDescriptorSetsLeft--;
@ -184,7 +184,7 @@ VulkanDescriptorSetLayout* VkDescriptorSetManager::GetTextureSetLayout(int numLa
builder.AddBinding(i, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT); builder.AddBinding(i, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT);
} }
builder.DebugName("VkDescriptorSetManager.TextureSetLayout"); builder.DebugName("VkDescriptorSetManager.TextureSetLayout");
layout = builder.Create(fb->device.get()); layout = builder.Create(fb->GetDevice());
return layout.get(); return layout.get();
} }
@ -225,7 +225,7 @@ VulkanDescriptorSet* VkDescriptorSetManager::GetInput(VkPPRenderPassSetup* passS
write.AddBuffer(descriptors.get(), LIGHTLIST_BINDINGPOINT, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetBufferManager()->LightList->mBuffer.get()); write.AddBuffer(descriptors.get(), LIGHTLIST_BINDINGPOINT, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, fb->GetBufferManager()->LightList->mBuffer.get());
} }
write.Execute(fb->device.get()); write.Execute(fb->GetDevice());
imageTransition.Execute(fb->GetCommands()->GetDrawCommands()); imageTransition.Execute(fb->GetCommands()->GetDrawCommands());
VulkanDescriptorSet* set = descriptors.get(); VulkanDescriptorSet* set = descriptors.get();
@ -249,7 +249,7 @@ std::unique_ptr<VulkanDescriptorSet> VkDescriptorSetManager::AllocatePPDescripto
.AddPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 4) .AddPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 4)
.MaxSets(100) .MaxSets(100)
.DebugName("PPDescriptorPool") .DebugName("PPDescriptorPool")
.Create(fb->device.get()); .Create(fb->GetDevice());
return PPDescriptorPool->allocate(layout); return PPDescriptorPool->allocate(layout);
} }
@ -263,7 +263,7 @@ void VkDescriptorSetManager::CreateHWBufferSetLayout()
.AddBinding(3, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT) .AddBinding(3, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT)
.AddBinding(4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT) .AddBinding(4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT)
.DebugName("VkDescriptorSetManager.HWBufferSetLayout") .DebugName("VkDescriptorSetManager.HWBufferSetLayout")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkDescriptorSetManager::CreateFixedSetLayout() void VkDescriptorSetManager::CreateFixedSetLayout()
@ -271,7 +271,7 @@ void VkDescriptorSetManager::CreateFixedSetLayout()
DescriptorSetLayoutBuilder builder; DescriptorSetLayoutBuilder builder;
builder.AddBinding(0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT); builder.AddBinding(0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT);
builder.AddBinding(1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT); builder.AddBinding(1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT);
if (fb->device->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME)) if (fb->GetDevice()->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME))
{ {
builder.AddBinding(2, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1, VK_SHADER_STAGE_FRAGMENT_BIT); builder.AddBinding(2, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1, VK_SHADER_STAGE_FRAGMENT_BIT);
} }
@ -282,7 +282,7 @@ void VkDescriptorSetManager::CreateFixedSetLayout()
builder.AddBinding(4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT); builder.AddBinding(4, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT);
} }
builder.DebugName("VkDescriptorSetManager.FixedSetLayout"); builder.DebugName("VkDescriptorSetManager.FixedSetLayout");
FixedSetLayout = builder.Create(fb->device.get()); FixedSetLayout = builder.Create(fb->GetDevice());
} }
void VkDescriptorSetManager::CreateHWBufferPool() void VkDescriptorSetManager::CreateHWBufferPool()
@ -292,14 +292,14 @@ void VkDescriptorSetManager::CreateHWBufferPool()
.AddPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2 * maxSets) .AddPoolSize(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 2 * maxSets)
.MaxSets(maxSets) .MaxSets(maxSets)
.DebugName("VkDescriptorSetManager.HWBufferDescriptorPool") .DebugName("VkDescriptorSetManager.HWBufferDescriptorPool")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkDescriptorSetManager::CreateFixedSetPool() void VkDescriptorSetManager::CreateFixedSetPool()
{ {
DescriptorPoolBuilder poolbuilder; DescriptorPoolBuilder poolbuilder;
poolbuilder.AddPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2 * maxSets); poolbuilder.AddPoolSize(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2 * maxSets);
if (fb->device->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME)) if (fb->GetDevice()->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME))
{ {
poolbuilder.AddPoolSize(VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1 * maxSets); poolbuilder.AddPoolSize(VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, 1 * maxSets);
} }
@ -309,5 +309,5 @@ void VkDescriptorSetManager::CreateFixedSetPool()
} }
poolbuilder.MaxSets(maxSets); poolbuilder.MaxSets(maxSets);
poolbuilder.DebugName("VkDescriptorSetManager.FixedDescriptorPool"); poolbuilder.DebugName("VkDescriptorSetManager.FixedDescriptorPool");
FixedDescriptorPool = poolbuilder.Create(fb->device.get()); FixedDescriptorPool = poolbuilder.Create(fb->GetDevice());
} }

View file

@ -34,15 +34,15 @@ CVAR(Bool, vk_exclusivefullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
VkFramebufferManager::VkFramebufferManager(VulkanRenderDevice* fb) : fb(fb) VkFramebufferManager::VkFramebufferManager(VulkanRenderDevice* fb) : fb(fb)
{ {
SwapChain = VulkanSwapChainBuilder() SwapChain = VulkanSwapChainBuilder()
.Create(fb->device.get()); .Create(fb->GetDevice());
SwapChainImageAvailableSemaphore = SemaphoreBuilder() SwapChainImageAvailableSemaphore = SemaphoreBuilder()
.DebugName("SwapChainImageAvailableSemaphore") .DebugName("SwapChainImageAvailableSemaphore")
.Create(fb->device.get()); .Create(fb->GetDevice());
RenderFinishedSemaphore = SemaphoreBuilder() RenderFinishedSemaphore = SemaphoreBuilder()
.DebugName("RenderFinishedSemaphore") .DebugName("RenderFinishedSemaphore")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
VkFramebufferManager::~VkFramebufferManager() VkFramebufferManager::~VkFramebufferManager()

View file

@ -63,7 +63,7 @@ VkRenderPassManager::VkRenderPassManager(VulkanRenderDevice* fb) : fb(fb)
{ {
} }
PipelineCache = builder.Create(fb->device.get()); PipelineCache = builder.Create(fb->GetDevice());
} }
VkRenderPassManager::~VkRenderPassManager() VkRenderPassManager::~VkRenderPassManager()
@ -155,7 +155,7 @@ VulkanPipelineLayout* VkRenderPassManager::GetPipelineLayout(int numLayers)
builder.AddSetLayout(descriptors->GetTextureSetLayout(numLayers)); builder.AddSetLayout(descriptors->GetTextureSetLayout(numLayers));
builder.AddPushConstantRange(VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(PushConstants)); builder.AddPushConstantRange(VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(PushConstants));
builder.DebugName("VkRenderPassManager.PipelineLayout"); builder.DebugName("VkRenderPassManager.PipelineLayout");
layout = builder.Create(fb->device.get()); layout = builder.Create(fb->GetDevice());
return layout.get(); return layout.get();
} }
@ -222,7 +222,7 @@ std::unique_ptr<VulkanRenderPass> VkRenderPassSetup::CreateRenderPass(int clearT
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT); VK_ACCESS_COLOR_ATTACHMENT_READ_BIT);
} }
builder.DebugName("VkRenderPassSetup.RenderPass"); builder.DebugName("VkRenderPassSetup.RenderPass");
return builder.Create(fb->device.get()); return builder.Create(fb->GetDevice());
} }
VulkanRenderPass *VkRenderPassSetup::GetRenderPass(int clearTargets) VulkanRenderPass *VkRenderPassSetup::GetRenderPass(int clearTargets)
@ -303,7 +303,7 @@ std::unique_ptr<VulkanPipeline> VkRenderPassSetup::CreatePipeline(const VkPipeli
builder.Topology(vktopology[key.DrawType]); builder.Topology(vktopology[key.DrawType]);
builder.DepthStencilEnable(key.DepthTest, key.DepthWrite, key.StencilTest); builder.DepthStencilEnable(key.DepthTest, key.DepthWrite, key.StencilTest);
builder.DepthFunc(depthfunc2vk[key.DepthFunc]); builder.DepthFunc(depthfunc2vk[key.DepthFunc]);
if (fb->device->EnabledFeatures.Features.depthClamp) if (fb->GetDevice()->EnabledFeatures.Features.depthClamp)
builder.DepthClampEnable(key.DepthClamp); builder.DepthClampEnable(key.DepthClamp);
builder.DepthBias(key.DepthBias, 0.0f, 0.0f, 0.0f); builder.DepthBias(key.DepthBias, 0.0f, 0.0f, 0.0f);
@ -321,7 +321,7 @@ std::unique_ptr<VulkanPipeline> VkRenderPassSetup::CreatePipeline(const VkPipeli
builder.RenderPass(GetRenderPass(0)); builder.RenderPass(GetRenderPass(0));
builder.DebugName("VkRenderPassSetup.Pipeline"); builder.DebugName("VkRenderPassSetup.Pipeline");
return builder.Create(fb->device.get()); return builder.Create(fb->GetDevice());
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -346,7 +346,7 @@ void VkPPRenderPassSetup::CreateDescriptorLayout(const VkPPRenderPassKey& key)
builder.AddBinding(LIGHTLIST_BINDINGPOINT, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT); builder.AddBinding(LIGHTLIST_BINDINGPOINT, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT);
} }
builder.DebugName("VkPPRenderPassSetup.DescriptorLayout"); builder.DebugName("VkPPRenderPassSetup.DescriptorLayout");
DescriptorLayout = builder.Create(fb->device.get()); DescriptorLayout = builder.Create(fb->GetDevice());
} }
void VkPPRenderPassSetup::CreatePipelineLayout(const VkPPRenderPassKey& key) void VkPPRenderPassSetup::CreatePipelineLayout(const VkPPRenderPassKey& key)
@ -356,7 +356,7 @@ void VkPPRenderPassSetup::CreatePipelineLayout(const VkPPRenderPassKey& key)
if (key.Uniforms > 0) if (key.Uniforms > 0)
builder.AddPushConstantRange(VK_SHADER_STAGE_FRAGMENT_BIT, 0, key.Uniforms); builder.AddPushConstantRange(VK_SHADER_STAGE_FRAGMENT_BIT, 0, key.Uniforms);
builder.DebugName("VkPPRenderPassSetup.PipelineLayout"); builder.DebugName("VkPPRenderPassSetup.PipelineLayout");
PipelineLayout = builder.Create(fb->device.get()); PipelineLayout = builder.Create(fb->GetDevice());
} }
void VkPPRenderPassSetup::CreatePipeline(const VkPPRenderPassKey& key) void VkPPRenderPassSetup::CreatePipeline(const VkPPRenderPassKey& key)
@ -386,7 +386,7 @@ void VkPPRenderPassSetup::CreatePipeline(const VkPPRenderPassKey& key)
builder.Layout(PipelineLayout.get()); builder.Layout(PipelineLayout.get());
builder.RenderPass(RenderPass.get()); builder.RenderPass(RenderPass.get());
builder.DebugName("VkPPRenderPassSetup.Pipeline"); builder.DebugName("VkPPRenderPassSetup.Pipeline");
Pipeline = builder.Create(fb->device.get()); Pipeline = builder.Create(fb->GetDevice());
} }
void VkPPRenderPassSetup::CreateRenderPass(const VkPPRenderPassKey& key) void VkPPRenderPassSetup::CreateRenderPass(const VkPPRenderPassKey& key)
@ -434,7 +434,7 @@ void VkPPRenderPassSetup::CreateRenderPass(const VkPPRenderPassKey& key)
} }
builder.DebugName("VkPPRenderPassSetup.RenderPass"); builder.DebugName("VkPPRenderPassSetup.RenderPass");
RenderPass = builder.Create(fb->device.get()); RenderPass = builder.Create(fb->GetDevice());
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -104,7 +104,7 @@ void VkSamplerManager::CreateHWSamplers()
builder.MaxLod(0.25f); builder.MaxLod(0.25f);
} }
builder.DebugName("VkSamplerManager.mSamplers"); builder.DebugName("VkSamplerManager.mSamplers");
mSamplers[i] = builder.Create(fb->device.get()); mSamplers[i] = builder.Create(fb->GetDevice());
} }
mSamplers[CLAMP_XY_NOMIP] = SamplerBuilder() mSamplers[CLAMP_XY_NOMIP] = SamplerBuilder()
@ -114,7 +114,7 @@ void VkSamplerManager::CreateHWSamplers()
.MipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST) .MipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST)
.MaxLod(0.25f) .MaxLod(0.25f)
.DebugName("VkSamplerManager.mSamplers") .DebugName("VkSamplerManager.mSamplers")
.Create(fb->device.get()); .Create(fb->GetDevice());
for (int i = CLAMP_NOFILTER; i <= CLAMP_NOFILTER_XY; i++) for (int i = CLAMP_NOFILTER; i <= CLAMP_NOFILTER_XY; i++)
{ {
@ -125,7 +125,7 @@ void VkSamplerManager::CreateHWSamplers()
.MipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST) .MipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST)
.MaxLod(0.25f) .MaxLod(0.25f)
.DebugName("VkSamplerManager.mSamplers") .DebugName("VkSamplerManager.mSamplers")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
// CAMTEX is repeating with texture filter and no mipmap // CAMTEX is repeating with texture filter and no mipmap
@ -136,7 +136,7 @@ void VkSamplerManager::CreateHWSamplers()
.MipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST) .MipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST)
.MaxLod(0.25f) .MaxLod(0.25f)
.DebugName("VkSamplerManager.mSamplers") .DebugName("VkSamplerManager.mSamplers")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkSamplerManager::DeleteHWSamplers() void VkSamplerManager::DeleteHWSamplers()
@ -161,7 +161,7 @@ VulkanSampler* VkSamplerManager::Get(PPFilterMode filter, PPWrapMode wrap)
.MagFilter(filter == PPFilterMode::Nearest ? VK_FILTER_NEAREST : VK_FILTER_LINEAR) .MagFilter(filter == PPFilterMode::Nearest ? VK_FILTER_NEAREST : VK_FILTER_LINEAR)
.AddressMode(wrap == PPWrapMode::Clamp ? VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE : VK_SAMPLER_ADDRESS_MODE_REPEAT) .AddressMode(wrap == PPWrapMode::Clamp ? VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE : VK_SAMPLER_ADDRESS_MODE_REPEAT)
.DebugName("VkPostprocess.mSamplers") .DebugName("VkPostprocess.mSamplers")
.Create(fb->device.get()); .Create(fb->GetDevice());
return sampler.get(); return sampler.get();
} }
@ -174,7 +174,7 @@ void VkSamplerManager::CreateShadowmapSampler()
.MagFilter(VK_FILTER_NEAREST) .MagFilter(VK_FILTER_NEAREST)
.AddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) .AddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
.DebugName("VkRenderBuffers.ShadowmapSampler") .DebugName("VkRenderBuffers.ShadowmapSampler")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkSamplerManager::CreateLightmapSampler() void VkSamplerManager::CreateLightmapSampler()
@ -185,5 +185,5 @@ void VkSamplerManager::CreateLightmapSampler()
.MagFilter(VK_FILTER_LINEAR) .MagFilter(VK_FILTER_LINEAR)
.AddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) .AddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE)
.DebugName("VkRenderBuffers.LightmapSampler") .DebugName("VkRenderBuffers.LightmapSampler")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }

View file

@ -39,13 +39,13 @@ VkPPShader::VkPPShader(VulkanRenderDevice* fb, PPShader *shader) : fb(fb)
.Type(ShaderType::Vertex) .Type(ShaderType::Vertex)
.AddSource(shader->VertexShader.GetChars(), LoadShaderCode(shader->VertexShader, "", shader->Version).GetChars()) .AddSource(shader->VertexShader.GetChars(), LoadShaderCode(shader->VertexShader, "", shader->Version).GetChars())
.DebugName(shader->VertexShader.GetChars()) .DebugName(shader->VertexShader.GetChars())
.Create(shader->VertexShader.GetChars(), fb->device.get()); .Create(shader->VertexShader.GetChars(), fb->GetDevice());
FragmentShader = ShaderBuilder() FragmentShader = ShaderBuilder()
.Type(ShaderType::Fragment) .Type(ShaderType::Fragment)
.AddSource(shader->FragmentShader.GetChars(), LoadShaderCode(shader->FragmentShader, prolog, shader->Version).GetChars()) .AddSource(shader->FragmentShader.GetChars(), LoadShaderCode(shader->FragmentShader, prolog, shader->Version).GetChars())
.DebugName(shader->FragmentShader.GetChars()) .DebugName(shader->FragmentShader.GetChars())
.Create(shader->FragmentShader.GetChars(), fb->device.get()); .Create(shader->FragmentShader.GetChars(), fb->GetDevice());
fb->GetShaderManager()->AddVkPPShader(this); fb->GetShaderManager()->AddVkPPShader(this);
} }

View file

@ -139,7 +139,7 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadVertShader(FString shadername
#ifdef NPOT_EMULATION #ifdef NPOT_EMULATION
definesBlock << "#define NPOT_EMULATION\n"; definesBlock << "#define NPOT_EMULATION\n";
#endif #endif
if (!fb->device->EnabledFeatures.Features.shaderClipDistance) if (!fb->GetDevice()->EnabledFeatures.Features.shaderClipDistance)
{ {
definesBlock << "#define NO_CLIPDISTANCE_SUPPORT\n"; definesBlock << "#define NO_CLIPDISTANCE_SUPPORT\n";
} }
@ -160,19 +160,19 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadVertShader(FString shadername
.AddSource(vert_lump, codeBlock.GetChars()) .AddSource(vert_lump, codeBlock.GetChars())
.OnIncludeLocal([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, false); }) .OnIncludeLocal([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, false); })
.OnIncludeSystem([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, true); }) .OnIncludeSystem([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, true); })
.Create(shadername.GetChars(), fb->device.get()); .Create(shadername.GetChars(), fb->GetDevice());
} }
std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char* mateffect_lump, const char *light_lump, const char *defines, const VkShaderKey& key) std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername, const char *frag_lump, const char *material_lump, const char* mateffect_lump, const char *light_lump, const char *defines, const VkShaderKey& key)
{ {
FString definesBlock; FString definesBlock;
if (fb->device->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME)) definesBlock << "\n#define SUPPORTS_RAYQUERY\n"; if (fb->GetDevice()->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME)) definesBlock << "\n#define SUPPORTS_RAYQUERY\n";
definesBlock << defines; definesBlock << defines;
definesBlock << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n"; definesBlock << "\n#define MAX_STREAM_DATA " << std::to_string(MAX_STREAM_DATA).c_str() << "\n";
#ifdef NPOT_EMULATION #ifdef NPOT_EMULATION
definesBlock << "#define NPOT_EMULATION\n"; definesBlock << "#define NPOT_EMULATION\n";
#endif #endif
if (!fb->device->EnabledFeatures.Features.shaderClipDistance) definesBlock << "#define NO_CLIPDISTANCE_SUPPORT\n"; if (!fb->GetDevice()->EnabledFeatures.Features.shaderClipDistance) definesBlock << "#define NO_CLIPDISTANCE_SUPPORT\n";
if (!key.AlphaTest) definesBlock << "#define NO_ALPHATEST\n"; if (!key.AlphaTest) definesBlock << "#define NO_ALPHATEST\n";
if (key.GBufferPass) definesBlock << "#define GBUFFER_PASS\n"; if (key.GBufferPass) definesBlock << "#define GBUFFER_PASS\n";
@ -240,14 +240,14 @@ std::unique_ptr<VulkanShader> VkShaderManager::LoadFragShader(FString shadername
.AddSource(frag_lump, codeBlock.GetChars()) .AddSource(frag_lump, codeBlock.GetChars())
.OnIncludeLocal([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, false); }) .OnIncludeLocal([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, false); })
.OnIncludeSystem([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, true); }) .OnIncludeSystem([=](std::string headerName, std::string includerName, size_t depth) { return OnInclude(headerName.c_str(), includerName.c_str(), depth, true); })
.Create(shadername.GetChars(), fb->device.get()); .Create(shadername.GetChars(), fb->GetDevice());
} }
FString VkShaderManager::GetVersionBlock() FString VkShaderManager::GetVersionBlock()
{ {
FString versionBlock; FString versionBlock;
if (fb->device->Instance->ApiVersion >= VK_API_VERSION_1_2) if (fb->GetDevice()->Instance->ApiVersion >= VK_API_VERSION_1_2)
{ {
versionBlock << "#version 460 core\n"; versionBlock << "#version 460 core\n";
} }
@ -258,7 +258,7 @@ FString VkShaderManager::GetVersionBlock()
versionBlock << "#extension GL_GOOGLE_include_directive : enable\n"; versionBlock << "#extension GL_GOOGLE_include_directive : enable\n";
if (fb->device->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME)) if (fb->GetDevice()->SupportsExtension(VK_KHR_RAY_QUERY_EXTENSION_NAME))
{ {
versionBlock << "#extension GL_EXT_ray_query : enable\n"; versionBlock << "#extension GL_EXT_ray_query : enable\n";
} }

View file

@ -87,14 +87,14 @@ VkTextureImage *VkHardwareTexture::GetDepthStencil(FTexture *tex)
.Format(format) .Format(format)
.Usage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) .Usage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)
.DebugName("VkHardwareTexture.DepthStencil") .DebugName("VkHardwareTexture.DepthStencil")
.Create(fb->device.get()); .Create(fb->GetDevice());
mDepthStencil.AspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; mDepthStencil.AspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
mDepthStencil.View = ImageViewBuilder() mDepthStencil.View = ImageViewBuilder()
.Image(mDepthStencil.Image.get(), format, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) .Image(mDepthStencil.Image.get(), format, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)
.DebugName("VkHardwareTexture.DepthStencilView") .DebugName("VkHardwareTexture.DepthStencilView")
.Create(fb->device.get()); .Create(fb->GetDevice());
VkImageTransition() VkImageTransition()
.AddImage(&mDepthStencil, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, true) .AddImage(&mDepthStencil, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, true)
@ -122,12 +122,12 @@ void VkHardwareTexture::CreateImage(FTexture *tex, int translation, int flags)
.Size(w, h) .Size(w, h)
.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT) .Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT)
.DebugName("VkHardwareTexture.mImage") .DebugName("VkHardwareTexture.mImage")
.Create(fb->device.get()); .Create(fb->GetDevice());
mImage.View = ImageViewBuilder() mImage.View = ImageViewBuilder()
.Image(mImage.Image.get(), format) .Image(mImage.Image.get(), format)
.DebugName("VkHardwareTexture.mImageView") .DebugName("VkHardwareTexture.mImageView")
.Create(fb->device.get()); .Create(fb->GetDevice());
VkImageTransition() VkImageTransition()
.AddImage(&mImage, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true) .AddImage(&mImage, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true)
@ -146,7 +146,7 @@ void VkHardwareTexture::CreateTexture(int w, int h, int pixelsize, VkFormat form
.Size(totalSize) .Size(totalSize)
.Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY) .Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY)
.DebugName("VkHardwareTexture.mStagingBuffer") .DebugName("VkHardwareTexture.mStagingBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
uint8_t *data = (uint8_t*)stagingBuffer->Map(0, totalSize); uint8_t *data = (uint8_t*)stagingBuffer->Map(0, totalSize);
memcpy(data, pixels, totalSize); memcpy(data, pixels, totalSize);
@ -157,12 +157,12 @@ void VkHardwareTexture::CreateTexture(int w, int h, int pixelsize, VkFormat form
.Size(w, h, !mipmap ? 1 : GetMipLevels(w, h)) .Size(w, h, !mipmap ? 1 : GetMipLevels(w, h))
.Usage(VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT) .Usage(VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT)
.DebugName("VkHardwareTexture.mImage") .DebugName("VkHardwareTexture.mImage")
.Create(fb->device.get()); .Create(fb->GetDevice());
mImage.View = ImageViewBuilder() mImage.View = ImageViewBuilder()
.Image(mImage.Image.get(), format) .Image(mImage.Image.get(), format)
.DebugName("VkHardwareTexture.mImageView") .DebugName("VkHardwareTexture.mImageView")
.Create(fb->device.get()); .Create(fb->GetDevice());
auto cmdbuffer = fb->GetCommands()->GetTransferCommands(); auto cmdbuffer = fb->GetCommands()->GetTransferCommands();
@ -219,14 +219,14 @@ void VkHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
.DebugName("VkHardwareTexture.mImage") .DebugName("VkHardwareTexture.mImage")
.Create(fb->device.get(), &allocatedBytes); .Create(fb->GetDevice(), &allocatedBytes);
mTexelsize = texelsize; mTexelsize = texelsize;
mImage.View = ImageViewBuilder() mImage.View = ImageViewBuilder()
.Image(mImage.Image.get(), format) .Image(mImage.Image.get(), format)
.DebugName("VkHardwareTexture.mImageView") .DebugName("VkHardwareTexture.mImageView")
.Create(fb->device.get()); .Create(fb->GetDevice());
VkImageTransition() VkImageTransition()
.AddImage(&mImage, VK_IMAGE_LAYOUT_GENERAL, true) .AddImage(&mImage, VK_IMAGE_LAYOUT_GENERAL, true)
@ -260,14 +260,14 @@ void VkHardwareTexture::CreateWipeTexture(int w, int h, const char *name)
.Size(w, h) .Size(w, h)
.Usage(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, VMA_MEMORY_USAGE_GPU_ONLY) .Usage(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, VMA_MEMORY_USAGE_GPU_ONLY)
.DebugName(name) .DebugName(name)
.Create(fb->device.get()); .Create(fb->GetDevice());
mTexelsize = 4; mTexelsize = 4;
mImage.View = ImageViewBuilder() mImage.View = ImageViewBuilder()
.Image(mImage.Image.get(), format) .Image(mImage.Image.get(), format)
.DebugName(name) .DebugName(name)
.Create(fb->device.get()); .Create(fb->GetDevice());
if (fb->GetBuffers()->GetWidth() > 0 && fb->GetBuffers()->GetHeight() > 0) if (fb->GetBuffers()->GetWidth() > 0 && fb->GetBuffers()->GetHeight() > 0)
{ {
@ -380,7 +380,7 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
update.AddCombinedImageSampler(descriptor.get(), i, dummyImage, sampler, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); update.AddCombinedImageSampler(descriptor.get(), i, dummyImage, sampler, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
} }
update.Execute(fb->device.get()); update.Execute(fb->GetDevice());
mDescriptorSets.emplace_back(clampmode, translationp, std::move(descriptor)); mDescriptorSets.emplace_back(clampmode, translationp, std::move(descriptor));
return mDescriptorSets.back().descriptor.get(); return mDescriptorSets.back().descriptor.get();
} }

View file

@ -47,15 +47,15 @@ VkPPTexture::VkPPTexture(VulkanRenderDevice* fb, PPTexture *texture) : fb(fb)
else else
imgbuilder.Usage(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); imgbuilder.Usage(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
imgbuilder.DebugName("VkPPTexture"); imgbuilder.DebugName("VkPPTexture");
if (!imgbuilder.IsFormatSupported(fb->device.get())) if (!imgbuilder.IsFormatSupported(fb->GetDevice()))
I_FatalError("Vulkan device does not support the image format required by a postprocess texture\n"); I_FatalError("Vulkan device does not support the image format required by a postprocess texture\n");
TexImage.Image = imgbuilder.Create(fb->device.get()); TexImage.Image = imgbuilder.Create(fb->GetDevice());
Format = format; Format = format;
TexImage.View = ImageViewBuilder() TexImage.View = ImageViewBuilder()
.Image(TexImage.Image.get(), format) .Image(TexImage.Image.get(), format)
.DebugName("VkPPTextureView") .DebugName("VkPPTextureView")
.Create(fb->device.get()); .Create(fb->GetDevice());
if (texture->Data) if (texture->Data)
{ {
@ -65,7 +65,7 @@ VkPPTexture::VkPPTexture(VulkanRenderDevice* fb, PPTexture *texture) : fb(fb)
.Size(totalsize) .Size(totalsize)
.Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY) .Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY)
.DebugName("VkPPTextureStaging") .DebugName("VkPPTextureStaging")
.Create(fb->device.get()); .Create(fb->GetDevice());
VkImageTransition() VkImageTransition()
.AddImage(&TexImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true) .AddImage(&TexImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true)

View file

@ -41,7 +41,7 @@ VkRenderBuffers::~VkRenderBuffers()
VkSampleCountFlagBits VkRenderBuffers::GetBestSampleCount() VkSampleCountFlagBits VkRenderBuffers::GetBestSampleCount()
{ {
const auto &limits = fb->device->PhysicalDevice.Properties.Properties.limits; const auto &limits = fb->GetDevice()->PhysicalDevice.Properties.Properties.limits;
VkSampleCountFlags deviceSampleCounts = limits.sampledImageColorSampleCounts & limits.sampledImageDepthSampleCounts & limits.sampledImageStencilSampleCounts; VkSampleCountFlags deviceSampleCounts = limits.sampledImageColorSampleCounts & limits.sampledImageDepthSampleCounts & limits.sampledImageStencilSampleCounts;
int requestedSamples = clamp((int)gl_multisample, 0, 64); int requestedSamples = clamp((int)gl_multisample, 0, 64);
@ -90,29 +90,29 @@ void VkRenderBuffers::CreatePipelineDepthStencil(int width, int height)
builder.Size(width, height); builder.Size(width, height);
builder.Format(PipelineDepthStencilFormat); builder.Format(PipelineDepthStencilFormat);
builder.Usage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); builder.Usage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
if (!builder.IsFormatSupported(fb->device.get())) if (!builder.IsFormatSupported(fb->GetDevice()))
{ {
PipelineDepthStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT; PipelineDepthStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
builder.Format(PipelineDepthStencilFormat); builder.Format(PipelineDepthStencilFormat);
if (!builder.IsFormatSupported(fb->device.get())) if (!builder.IsFormatSupported(fb->GetDevice()))
{ {
I_FatalError("This device does not support any of the required depth stencil image formats."); I_FatalError("This device does not support any of the required depth stencil image formats.");
} }
} }
builder.DebugName("VkRenderBuffers.PipelineDepthStencil"); builder.DebugName("VkRenderBuffers.PipelineDepthStencil");
PipelineDepthStencil.Image = builder.Create(fb->device.get()); PipelineDepthStencil.Image = builder.Create(fb->GetDevice());
PipelineDepthStencil.AspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; PipelineDepthStencil.AspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
PipelineDepthStencil.View = ImageViewBuilder() PipelineDepthStencil.View = ImageViewBuilder()
.Image(PipelineDepthStencil.Image.get(), PipelineDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) .Image(PipelineDepthStencil.Image.get(), PipelineDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)
.DebugName("VkRenderBuffers.PipelineDepthStencilView") .DebugName("VkRenderBuffers.PipelineDepthStencilView")
.Create(fb->device.get()); .Create(fb->GetDevice());
PipelineDepthStencil.DepthOnlyView = ImageViewBuilder() PipelineDepthStencil.DepthOnlyView = ImageViewBuilder()
.Image(PipelineDepthStencil.Image.get(), PipelineDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT) .Image(PipelineDepthStencil.Image.get(), PipelineDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT)
.DebugName("VkRenderBuffers.PipelineDepthView") .DebugName("VkRenderBuffers.PipelineDepthView")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkRenderBuffers::CreatePipeline(int width, int height) void VkRenderBuffers::CreatePipeline(int width, int height)
@ -134,12 +134,12 @@ void VkRenderBuffers::CreatePipeline(int width, int height)
.Format(VK_FORMAT_R16G16B16A16_SFLOAT) .Format(VK_FORMAT_R16G16B16A16_SFLOAT)
.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) .Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT)
.DebugName("VkRenderBuffers.PipelineImage") .DebugName("VkRenderBuffers.PipelineImage")
.Create(fb->device.get()); .Create(fb->GetDevice());
PipelineImage[i].View = ImageViewBuilder() PipelineImage[i].View = ImageViewBuilder()
.Image(PipelineImage[i].Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT) .Image(PipelineImage[i].Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT)
.DebugName("VkRenderBuffers.PipelineView") .DebugName("VkRenderBuffers.PipelineView")
.Create(fb->device.get()); .Create(fb->GetDevice());
barrier.AddImage(&PipelineImage[i], VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true); barrier.AddImage(&PipelineImage[i], VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true);
} }
@ -174,12 +174,12 @@ void VkRenderBuffers::CreateSceneColor(int width, int height, VkSampleCountFlagB
.Format(VK_FORMAT_R16G16B16A16_SFLOAT) .Format(VK_FORMAT_R16G16B16A16_SFLOAT)
.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT) .Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT)
.DebugName("VkRenderBuffers.SceneColor") .DebugName("VkRenderBuffers.SceneColor")
.Create(fb->device.get()); .Create(fb->GetDevice());
SceneColor.View = ImageViewBuilder() SceneColor.View = ImageViewBuilder()
.Image(SceneColor.Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT) .Image(SceneColor.Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT)
.DebugName("VkRenderBuffers.SceneColorView") .DebugName("VkRenderBuffers.SceneColorView")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkRenderBuffers::CreateSceneDepthStencil(int width, int height, VkSampleCountFlagBits samples) void VkRenderBuffers::CreateSceneDepthStencil(int width, int height, VkSampleCountFlagBits samples)
@ -189,29 +189,29 @@ void VkRenderBuffers::CreateSceneDepthStencil(int width, int height, VkSampleCou
builder.Samples(samples); builder.Samples(samples);
builder.Format(SceneDepthStencilFormat); builder.Format(SceneDepthStencilFormat);
builder.Usage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); builder.Usage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
if (!builder.IsFormatSupported(fb->device.get())) if (!builder.IsFormatSupported(fb->GetDevice()))
{ {
SceneDepthStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT; SceneDepthStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
builder.Format(SceneDepthStencilFormat); builder.Format(SceneDepthStencilFormat);
if (!builder.IsFormatSupported(fb->device.get())) if (!builder.IsFormatSupported(fb->GetDevice()))
{ {
I_FatalError("This device does not support any of the required depth stencil image formats."); I_FatalError("This device does not support any of the required depth stencil image formats.");
} }
} }
builder.DebugName("VkRenderBuffers.SceneDepthStencil"); builder.DebugName("VkRenderBuffers.SceneDepthStencil");
SceneDepthStencil.Image = builder.Create(fb->device.get()); SceneDepthStencil.Image = builder.Create(fb->GetDevice());
SceneDepthStencil.AspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; SceneDepthStencil.AspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
SceneDepthStencil.View = ImageViewBuilder() SceneDepthStencil.View = ImageViewBuilder()
.Image(SceneDepthStencil.Image.get(), SceneDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) .Image(SceneDepthStencil.Image.get(), SceneDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)
.DebugName("VkRenderBuffers.SceneDepthStencilView") .DebugName("VkRenderBuffers.SceneDepthStencilView")
.Create(fb->device.get()); .Create(fb->GetDevice());
SceneDepthStencil.DepthOnlyView = ImageViewBuilder() SceneDepthStencil.DepthOnlyView = ImageViewBuilder()
.Image(SceneDepthStencil.Image.get(), SceneDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT) .Image(SceneDepthStencil.Image.get(), SceneDepthStencilFormat, VK_IMAGE_ASPECT_DEPTH_BIT)
.DebugName("VkRenderBuffers.SceneDepthView") .DebugName("VkRenderBuffers.SceneDepthView")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkRenderBuffers::CreateSceneFog(int width, int height, VkSampleCountFlagBits samples) void VkRenderBuffers::CreateSceneFog(int width, int height, VkSampleCountFlagBits samples)
@ -222,12 +222,12 @@ void VkRenderBuffers::CreateSceneFog(int width, int height, VkSampleCountFlagBit
.Format(VK_FORMAT_R8G8B8A8_UNORM) .Format(VK_FORMAT_R8G8B8A8_UNORM)
.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT) .Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT)
.DebugName("VkRenderBuffers.SceneFog") .DebugName("VkRenderBuffers.SceneFog")
.Create(fb->device.get()); .Create(fb->GetDevice());
SceneFog.View = ImageViewBuilder() SceneFog.View = ImageViewBuilder()
.Image(SceneFog.Image.get(), VK_FORMAT_R8G8B8A8_UNORM) .Image(SceneFog.Image.get(), VK_FORMAT_R8G8B8A8_UNORM)
.DebugName("VkRenderBuffers.SceneFogView") .DebugName("VkRenderBuffers.SceneFogView")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
void VkRenderBuffers::CreateSceneNormal(int width, int height, VkSampleCountFlagBits samples) void VkRenderBuffers::CreateSceneNormal(int width, int height, VkSampleCountFlagBits samples)
@ -237,19 +237,19 @@ void VkRenderBuffers::CreateSceneNormal(int width, int height, VkSampleCountFlag
builder.Samples(samples); builder.Samples(samples);
builder.Format(SceneNormalFormat); builder.Format(SceneNormalFormat);
builder.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); builder.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
if (!builder.IsFormatSupported(fb->device.get(), VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) if (!builder.IsFormatSupported(fb->GetDevice(), VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
{ {
SceneNormalFormat = VK_FORMAT_R8G8B8A8_UNORM; SceneNormalFormat = VK_FORMAT_R8G8B8A8_UNORM;
builder.Format(SceneNormalFormat); builder.Format(SceneNormalFormat);
} }
builder.DebugName("VkRenderBuffers.SceneNormal"); builder.DebugName("VkRenderBuffers.SceneNormal");
SceneNormal.Image = builder.Create(fb->device.get()); SceneNormal.Image = builder.Create(fb->GetDevice());
SceneNormal.View = ImageViewBuilder() SceneNormal.View = ImageViewBuilder()
.Image(SceneNormal.Image.get(), SceneNormalFormat) .Image(SceneNormal.Image.get(), SceneNormalFormat)
.DebugName("VkRenderBuffers.SceneNormalView") .DebugName("VkRenderBuffers.SceneNormalView")
.Create(fb->device.get()); .Create(fb->GetDevice());
} }
VulkanFramebuffer* VkRenderBuffers::GetOutput(VkPPRenderPassSetup* passSetup, const PPOutput& output, WhichDepthStencil stencilTest, int& framebufferWidth, int& framebufferHeight) VulkanFramebuffer* VkRenderBuffers::GetOutput(VkPPRenderPassSetup* passSetup, const PPOutput& output, WhichDepthStencil stencilTest, int& framebufferWidth, int& framebufferHeight)
@ -296,7 +296,7 @@ VulkanFramebuffer* VkRenderBuffers::GetOutput(VkPPRenderPassSetup* passSetup, co
if (stencilTest == WhichDepthStencil::Pipeline) if (stencilTest == WhichDepthStencil::Pipeline)
builder.AddAttachment(fb->GetBuffers()->PipelineDepthStencil.View.get()); builder.AddAttachment(fb->GetBuffers()->PipelineDepthStencil.View.get());
builder.DebugName("PPOutputFB"); builder.DebugName("PPOutputFB");
framebuffer = builder.Create(fb->device.get()); framebuffer = builder.Create(fb->GetDevice());
} }
framebufferWidth = w; framebufferWidth = w;

View file

@ -148,12 +148,12 @@ void VkTextureManager::CreateNullTexture()
.Size(1, 1) .Size(1, 1)
.Usage(VK_IMAGE_USAGE_SAMPLED_BIT) .Usage(VK_IMAGE_USAGE_SAMPLED_BIT)
.DebugName("VkDescriptorSetManager.NullTexture") .DebugName("VkDescriptorSetManager.NullTexture")
.Create(fb->device.get()); .Create(fb->GetDevice());
NullTextureView = ImageViewBuilder() NullTextureView = ImageViewBuilder()
.Image(NullTexture.get(), VK_FORMAT_R8G8B8A8_UNORM) .Image(NullTexture.get(), VK_FORMAT_R8G8B8A8_UNORM)
.DebugName("VkDescriptorSetManager.NullTextureView") .DebugName("VkDescriptorSetManager.NullTextureView")
.Create(fb->device.get()); .Create(fb->GetDevice());
PipelineBarrier() PipelineBarrier()
.AddImage(NullTexture.get(), VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 0, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_ASPECT_COLOR_BIT) .AddImage(NullTexture.get(), VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 0, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_ASPECT_COLOR_BIT)
@ -167,12 +167,12 @@ void VkTextureManager::CreateShadowmap()
.Format(VK_FORMAT_R32_SFLOAT) .Format(VK_FORMAT_R32_SFLOAT)
.Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT) .Usage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT)
.DebugName("VkRenderBuffers.Shadowmap") .DebugName("VkRenderBuffers.Shadowmap")
.Create(fb->device.get()); .Create(fb->GetDevice());
Shadowmap.View = ImageViewBuilder() Shadowmap.View = ImageViewBuilder()
.Image(Shadowmap.Image.get(), VK_FORMAT_R32_SFLOAT) .Image(Shadowmap.Image.get(), VK_FORMAT_R32_SFLOAT)
.DebugName("VkRenderBuffers.ShadowmapView") .DebugName("VkRenderBuffers.ShadowmapView")
.Create(fb->device.get()); .Create(fb->GetDevice());
VkImageTransition() VkImageTransition()
.AddImage(&Shadowmap, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true) .AddImage(&Shadowmap, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true)
@ -203,13 +203,13 @@ void VkTextureManager::SetLightmap(int LMTextureSize, int LMTextureCount, const
.Format(VK_FORMAT_R16G16B16A16_SFLOAT) .Format(VK_FORMAT_R16G16B16A16_SFLOAT)
.Usage(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) .Usage(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT)
.DebugName("VkRenderBuffers.Lightmap") .DebugName("VkRenderBuffers.Lightmap")
.Create(fb->device.get()); .Create(fb->GetDevice());
Lightmap.View = ImageViewBuilder() Lightmap.View = ImageViewBuilder()
.Type(VK_IMAGE_VIEW_TYPE_2D_ARRAY) .Type(VK_IMAGE_VIEW_TYPE_2D_ARRAY)
.Image(Lightmap.Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT) .Image(Lightmap.Image.get(), VK_FORMAT_R16G16B16A16_SFLOAT)
.DebugName("VkRenderBuffers.LightmapView") .DebugName("VkRenderBuffers.LightmapView")
.Create(fb->device.get()); .Create(fb->GetDevice());
auto cmdbuffer = fb->GetCommands()->GetTransferCommands(); auto cmdbuffer = fb->GetCommands()->GetTransferCommands();
@ -219,7 +219,7 @@ void VkTextureManager::SetLightmap(int LMTextureSize, int LMTextureCount, const
.Size(totalSize) .Size(totalSize)
.Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY) .Usage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY)
.DebugName("VkHardwareTexture.mStagingBuffer") .DebugName("VkHardwareTexture.mStagingBuffer")
.Create(fb->device.get()); .Create(fb->GetDevice());
uint16_t one = 0x3c00; // half-float 1.0 uint16_t one = 0x3c00; // half-float 1.0
const uint16_t* src = LMTextureData.Data(); const uint16_t* src = LMTextureData.Data();

View file

@ -119,20 +119,19 @@ void VulkanPrintLog(const char* typestr, const std::string& msg)
} }
} }
VulkanRenderDevice::VulkanRenderDevice(void *hMonitor, bool fullscreen, std::shared_ptr<VulkanSurface> surface) : VulkanRenderDevice::VulkanRenderDevice(void *hMonitor, bool fullscreen, std::shared_ptr<VulkanSurface> surface) : SystemBaseFrameBuffer(hMonitor, fullscreen)
Super(hMonitor, fullscreen)
{ {
VulkanDeviceBuilder builder; VulkanDeviceBuilder builder;
builder.OptionalRayQuery(); builder.OptionalRayQuery();
builder.Surface(surface); builder.Surface(surface);
builder.SelectDevice(vk_device); builder.SelectDevice(vk_device);
SupportedDevices = builder.FindDevices(surface->Instance); SupportedDevices = builder.FindDevices(surface->Instance);
device = builder.Create(surface->Instance); mDevice = builder.Create(surface->Instance);
} }
VulkanRenderDevice::~VulkanRenderDevice() VulkanRenderDevice::~VulkanRenderDevice()
{ {
vkDeviceWaitIdle(device->device); // make sure the GPU is no longer using any objects before RAII tears them down vkDeviceWaitIdle(mDevice->device); // make sure the GPU is no longer using any objects before RAII tears them down
delete mVertexData; delete mVertexData;
delete mSkyData; delete mSkyData;
@ -163,7 +162,7 @@ void VulkanRenderDevice::InitializeState()
} }
// Use the same names here as OpenGL returns. // Use the same names here as OpenGL returns.
switch (device->PhysicalDevice.Properties.Properties.vendorID) switch (mDevice->PhysicalDevice.Properties.Properties.vendorID)
{ {
case 0x1002: vendorstring = "ATI Technologies Inc."; break; case 0x1002: vendorstring = "ATI Technologies Inc."; break;
case 0x10DE: vendorstring = "NVIDIA Corporation"; break; case 0x10DE: vendorstring = "NVIDIA Corporation"; break;
@ -173,8 +172,8 @@ void VulkanRenderDevice::InitializeState()
hwcaps = RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE; hwcaps = RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE;
glslversion = 4.50f; glslversion = 4.50f;
uniformblockalignment = (unsigned int)device->PhysicalDevice.Properties.Properties.limits.minUniformBufferOffsetAlignment; uniformblockalignment = (unsigned int)mDevice->PhysicalDevice.Properties.Properties.limits.minUniformBufferOffsetAlignment;
maxuniformblock = device->PhysicalDevice.Properties.Properties.limits.maxUniformBufferRange; maxuniformblock = mDevice->PhysicalDevice.Properties.Properties.limits.maxUniformBufferRange;
mCommands.reset(new VkCommandBufferManager(this)); mCommands.reset(new VkCommandBufferManager(this));
@ -228,7 +227,7 @@ void VulkanRenderDevice::Update()
mCommands->WaitForCommands(true); mCommands->WaitForCommands(true);
mCommands->UpdateGpuStats(); mCommands->UpdateGpuStats();
Super::Update(); SystemBaseFrameBuffer::Update();
} }
bool VulkanRenderDevice::CompileNextShader() bool VulkanRenderDevice::CompileNextShader()
@ -277,7 +276,8 @@ void VulkanRenderDevice::PostProcessScene(bool swscene, int fixedcm, float flash
const char* VulkanRenderDevice::DeviceName() const const char* VulkanRenderDevice::DeviceName() const
{ {
return device->PhysicalDevice.Properties.Properties.deviceName; const auto &props = mDevice->PhysicalDevice.Properties;
return props.Properties.deviceName;
} }
void VulkanRenderDevice::SetVSync(bool vsync) void VulkanRenderDevice::SetVSync(bool vsync)
@ -390,7 +390,7 @@ void VulkanRenderDevice::CopyScreenToBuffer(int w, int h, uint8_t *data)
.Usage(VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT) .Usage(VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT)
.Size(w, h) .Size(w, h)
.DebugName("CopyScreenToBuffer") .DebugName("CopyScreenToBuffer")
.Create(device.get()); .Create(mDevice.get());
GetPostprocess()->BlitCurrentToImage(&image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); GetPostprocess()->BlitCurrentToImage(&image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
@ -399,7 +399,7 @@ void VulkanRenderDevice::CopyScreenToBuffer(int w, int h, uint8_t *data)
.Size(w * h * 4) .Size(w * h * 4)
.Usage(VK_BUFFER_USAGE_TRANSFER_DST_BIT, VMA_MEMORY_USAGE_GPU_TO_CPU) .Usage(VK_BUFFER_USAGE_TRANSFER_DST_BIT, VMA_MEMORY_USAGE_GPU_TO_CPU)
.DebugName("CopyScreenToBuffer") .DebugName("CopyScreenToBuffer")
.Create(device.get()); .Create(mDevice.get());
// Copy from image to buffer // Copy from image to buffer
VkBufferImageCopy region = {}; VkBufferImageCopy region = {};
@ -496,7 +496,7 @@ unsigned int VulkanRenderDevice::GetLightBufferBlockSize() const
void VulkanRenderDevice::PrintStartupLog() void VulkanRenderDevice::PrintStartupLog()
{ {
const auto &props = device->PhysicalDevice.Properties.Properties; const auto &props = mDevice->PhysicalDevice.Properties.Properties;
FString deviceType; FString deviceType;
switch (props.deviceType) switch (props.deviceType)
@ -519,7 +519,7 @@ void VulkanRenderDevice::PrintStartupLog()
Printf("Vulkan version: %s (api) %s (driver)\n", apiVersion.GetChars(), driverVersion.GetChars()); Printf("Vulkan version: %s (api) %s (driver)\n", apiVersion.GetChars(), driverVersion.GetChars());
Printf(PRINT_LOG, "Vulkan extensions:"); Printf(PRINT_LOG, "Vulkan extensions:");
for (const VkExtensionProperties &p : device->PhysicalDevice.Extensions) for (const VkExtensionProperties &p : mDevice->PhysicalDevice.Extensions)
{ {
Printf(PRINT_LOG, " %s", p.extensionName); Printf(PRINT_LOG, " %s", p.extensionName);
} }

View file

@ -25,12 +25,11 @@ class SWSceneDrawer;
class VulkanRenderDevice : public SystemBaseFrameBuffer class VulkanRenderDevice : public SystemBaseFrameBuffer
{ {
typedef SystemBaseFrameBuffer Super;
public: public:
std::shared_ptr<VulkanDevice> device; VulkanRenderDevice(void* hMonitor, bool fullscreen, std::shared_ptr<VulkanSurface> surface);
~VulkanRenderDevice();
VulkanDevice* GetDevice() { return mDevice.get(); }
VkCommandBufferManager* GetCommands() { return mCommands.get(); } VkCommandBufferManager* GetCommands() { return mCommands.get(); }
VkShaderManager *GetShaderManager() { return mShaderManager.get(); } VkShaderManager *GetShaderManager() { return mShaderManager.get(); }
VkSamplerManager *GetSamplerManager() { return mSamplerManager.get(); } VkSamplerManager *GetSamplerManager() { return mSamplerManager.get(); }
@ -47,8 +46,6 @@ public:
unsigned int GetLightBufferBlockSize() const; unsigned int GetLightBufferBlockSize() const;
VulkanRenderDevice(void *hMonitor, bool fullscreen, std::shared_ptr<VulkanSurface> surface);
~VulkanRenderDevice();
bool IsVulkan() override { return true; } bool IsVulkan() override { return true; }
void Update() override; void Update() override;
@ -96,6 +93,7 @@ private:
void PrintStartupLog(); void PrintStartupLog();
void CopyScreenToBuffer(int w, int h, uint8_t *data) override; void CopyScreenToBuffer(int w, int h, uint8_t *data) override;
std::shared_ptr<VulkanDevice> mDevice;
std::unique_ptr<VkCommandBufferManager> mCommands; std::unique_ptr<VkCommandBufferManager> mCommands;
std::unique_ptr<VkBufferManager> mBufferManager; std::unique_ptr<VkBufferManager> mBufferManager;
std::unique_ptr<VkSamplerManager> mSamplerManager; std::unique_ptr<VkSamplerManager> mSamplerManager;

View file

@ -560,7 +560,7 @@ void VkRenderState::BeginRenderPass(VulkanCommandBuffer *cmdbuffer)
if (key.DepthStencil) if (key.DepthStencil)
builder.AddAttachment(mRenderTarget.DepthStencil); builder.AddAttachment(mRenderTarget.DepthStencil);
builder.DebugName("VkRenderPassSetup.Framebuffer"); builder.DebugName("VkRenderPassSetup.Framebuffer");
framebuffer = builder.Create(fb->device.get()); framebuffer = builder.Create(fb->GetDevice());
} }
// Only clear depth+stencil if the render target actually has that // Only clear depth+stencil if the render target actually has that