mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Remove the USE_GENERAL_LAYOUT_FOR* debug defines.
This commit is contained in:
parent
e870b29e85
commit
940611fe65
@ -1126,24 +1126,6 @@ void TransitionImageLayout2(VkCommandBuffer cmd, VkImage image, int baseMip, int
|
||||
VkImageLayout oldImageLayout, VkImageLayout newImageLayout,
|
||||
VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
|
||||
VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask) {
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
if (aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
// Hack to disable transaction elimination on ARM Mali.
|
||||
if (oldImageLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || oldImageLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
oldImageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
if (newImageLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || newImageLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
newImageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
#endif
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_DEPTH_STENCIL
|
||||
if (aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
// Hack to disable transaction elimination on ARM Mali.
|
||||
if (oldImageLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || oldImageLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
oldImageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
if (newImageLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || newImageLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
newImageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
#endif
|
||||
VkImageMemoryBarrier image_memory_barrier{ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER };
|
||||
image_memory_barrier.srcAccessMask = srcAccessMask;
|
||||
image_memory_barrier.dstAccessMask = dstAccessMask;
|
||||
|
@ -107,12 +107,6 @@ private:
|
||||
std::vector<Callback> callbacks_;
|
||||
};
|
||||
|
||||
// Useful for debugging on ARM Mali. This eliminates transaction elimination
|
||||
// which can cause artifacts if you get barriers wrong (or if there are driver bugs).
|
||||
// Cost is reduced performance on some GPU architectures.
|
||||
// #define VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
// #define VULKAN_USE_GENERAL_LAYOUT_FOR_DEPTH_STENCIL
|
||||
|
||||
// VulkanContext manages the device and swapchain, and deferred deletion of objects.
|
||||
class VulkanContext {
|
||||
public:
|
||||
|
@ -126,22 +126,13 @@ void VulkanQueueRunner::InitBackbufferRenderPass() {
|
||||
attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; // Don't care about storing backbuffer Z - we clear it anyway.
|
||||
attachments[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||
attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_DEPTH_STENCIL
|
||||
attachments[1].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
attachments[1].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
attachments[1].initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
attachments[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
#endif
|
||||
attachments[1].flags = 0;
|
||||
|
||||
VkAttachmentReference color_reference{};
|
||||
color_reference.attachment = 0;
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
color_reference.layout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
color_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
#endif
|
||||
|
||||
VkAttachmentReference depth_reference{};
|
||||
depth_reference.attachment = 1;
|
||||
@ -204,13 +195,8 @@ VkRenderPass VulkanQueueRunner::GetRenderPass(const RPKey &key) {
|
||||
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
attachments[0].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
attachments[0].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
attachments[0].initialLayout = key.prevColorLayout;
|
||||
attachments[0].finalLayout = key.finalColorLayout;
|
||||
#endif
|
||||
attachments[0].flags = 0;
|
||||
|
||||
attachments[1].format = vulkan_->GetDeviceInfo().preferredDepthStencilFormat;
|
||||
@ -239,13 +225,8 @@ VkRenderPass VulkanQueueRunner::GetRenderPass(const RPKey &key) {
|
||||
}
|
||||
attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_DEPTH_STENCIL
|
||||
attachments[1].initialLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
attachments[1].finalLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
attachments[1].initialLayout = key.prevDepthStencilLayout;
|
||||
attachments[1].finalLayout = key.finalDepthStencilLayout;
|
||||
#endif
|
||||
attachments[1].flags = 0;
|
||||
|
||||
VkAttachmentReference color_reference{};
|
||||
@ -1580,24 +1561,6 @@ void VulkanQueueRunner::SetupTransitionToTransferSrc(VKRImage &img, VkImageMemor
|
||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
img.layout = barrier.newLayout;
|
||||
|
||||
// NOTE: Must do this AFTER updating img.layout to avoid behaviour differences.
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
if (aspect == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (barrier.oldLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || barrier.oldLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
if (barrier.newLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || barrier.newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
#endif
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_DEPTH_STENCIL
|
||||
if (aspect != VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (barrier.oldLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || barrier.oldLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
if (barrier.newLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || barrier.newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void VulkanQueueRunner::SetupTransitionToTransferDst(VKRImage &img, VkImageMemoryBarrier &barrier, VkPipelineStageFlags &stage, VkImageAspectFlags aspect) {
|
||||
@ -1639,24 +1602,6 @@ void VulkanQueueRunner::SetupTransitionToTransferDst(VKRImage &img, VkImageMemor
|
||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
img.layout = barrier.newLayout;
|
||||
|
||||
// NOTE: Must do this AFTER updating img.layout to avoid behaviour differences.
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
if (aspect == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (barrier.oldLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || barrier.oldLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
if (barrier.newLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL || barrier.newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
#endif
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_DEPTH_STENCIL
|
||||
if (aspect != VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (barrier.oldLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || barrier.oldLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
if (barrier.newLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL || barrier.newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
|
||||
barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void VulkanQueueRunner::PerformReadback(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
|
@ -993,11 +993,7 @@ VkDescriptorSet VKContext::GetOrCreateDescriptorSet(VkBuffer buf) {
|
||||
if (key.imageViews_[i] && key.samplers_[i] && key.samplers_[i]->GetSampler()) {
|
||||
imageDesc[i].imageView = key.imageViews_[i];
|
||||
imageDesc[i].sampler = key.samplers_[i]->GetSampler();
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
imageDesc[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
imageDesc[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
#endif
|
||||
writes[numWrites].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
writes[numWrites].dstSet = descSet;
|
||||
writes[numWrites].dstArrayElement = 0;
|
||||
|
@ -446,11 +446,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView
|
||||
if (imageView) {
|
||||
_dbg_assert_(sampler != VK_NULL_HANDLE);
|
||||
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
tex[0].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
tex[0].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
#endif
|
||||
tex[0].imageView = imageView;
|
||||
tex[0].sampler = sampler;
|
||||
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
@ -464,11 +460,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView
|
||||
}
|
||||
|
||||
if (boundSecondary_) {
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
tex[1].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
tex[1].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
#endif
|
||||
tex[1].imageView = boundSecondary_;
|
||||
tex[1].sampler = samplerSecondary_;
|
||||
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
@ -482,11 +474,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView
|
||||
}
|
||||
|
||||
if (boundDepal_) {
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
tex[2].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
tex[2].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
#endif
|
||||
tex[2].imageView = boundDepal_;
|
||||
tex[2].sampler = samplerSecondary_; // doesn't matter, we use load
|
||||
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
|
@ -196,11 +196,7 @@ VkDescriptorSet Vulkan2D::GetDescriptorSet(VkImageView tex1, VkSampler sampler1,
|
||||
VkDescriptorImageInfo image1{};
|
||||
VkDescriptorImageInfo image2{};
|
||||
if (tex1 && sampler1) {
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
image1.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
image1.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
#endif
|
||||
image1.imageView = tex1;
|
||||
image1.sampler = sampler1;
|
||||
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
@ -213,11 +209,7 @@ VkDescriptorSet Vulkan2D::GetDescriptorSet(VkImageView tex1, VkSampler sampler1,
|
||||
}
|
||||
if (tex2 && sampler2) {
|
||||
// TODO: Also support LAYOUT_GENERAL to be able to texture from framebuffers without transitioning them?
|
||||
#ifdef VULKAN_USE_GENERAL_LAYOUT_FOR_COLOR
|
||||
image2.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
#else
|
||||
image2.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
#endif
|
||||
image2.imageView = tex2;
|
||||
image2.sampler = sampler2;
|
||||
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
|
Loading…
Reference in New Issue
Block a user