Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions renderdoc/driver/vulkan/vk_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,9 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan,
{
attachments[i].blendEnable =
pCreateInfo->pColorBlendState->pAttachments[i].blendEnable ? true : false;
// Write is implicitly enabled, unless overriden by VkPipelineColorWriteCreateInfoEXT
// (below) or dynamic state.
attachments[i].writeEnable = true;

attachments[i].blend.Source =
pCreateInfo->pColorBlendState->pAttachments[i].srcColorBlendFactor;
Expand Down Expand Up @@ -1734,8 +1737,7 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan,
RDCASSERTEQUAL(attachments.size(), colorWriteEnable->attachmentCount);
for(size_t i = 0; i < attachments.size() && i < colorWriteEnable->attachmentCount; i++)
{
if(!colorWriteEnable->pColorWriteEnables[i])
attachments[i].channelWriteMask = 0;
attachments[i].writeEnable = colorWriteEnable->pColorWriteEnables[i] ? true : false;
}
}

Expand Down
1 change: 1 addition & 0 deletions renderdoc/driver/vulkan/vk_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ struct VulkanCreationInfo
struct CBAttachment
{
bool blendEnable;
bool writeEnable;

struct BlendOp
{
Expand Down
20 changes: 20 additions & 0 deletions renderdoc/driver/vulkan/vk_shader_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ void VulkanShaderCache::MakeGraphicsPipelineInfo(VkGraphicsPipelineCreateInfo &p
cb.attachmentCount = (uint32_t)pipeInfo.attachments.size();
cb.pAttachments = atts;

bool anyWriteDisables = false;
for(uint32_t i = 0; i < cb.attachmentCount; i++)
{
atts[i].blendEnable = pipeInfo.attachments[i].blendEnable;
Expand All @@ -972,6 +973,25 @@ void VulkanShaderCache::MakeGraphicsPipelineInfo(VkGraphicsPipelineCreateInfo &p
atts[i].colorBlendOp = pipeInfo.attachments[i].blend.Operation;
atts[i].srcColorBlendFactor = pipeInfo.attachments[i].blend.Source;
atts[i].dstColorBlendFactor = pipeInfo.attachments[i].blend.Destination;

anyWriteDisables = anyWriteDisables || !pipeInfo.attachments[i].writeEnable;
}

static VkPipelineColorWriteCreateInfoEXT cw = {
VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT};

static VkBool32 writeEnables[32] = {};
cw.attachmentCount = cb.attachmentCount;
cw.pColorWriteEnables = writeEnables;

if(anyWriteDisables)
{
for(uint32_t i = 0; i < cb.attachmentCount; i++)
{
writeEnables[i] = pipeInfo.attachments[i].writeEnable;
}
cw.pNext = rs.pNext;
rs.pNext = &cw;
}

RDCASSERT(ARRAY_COUNT(atts) >= pipeInfo.attachments.size());
Expand Down
2 changes: 1 addition & 1 deletion renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3575,7 +3575,7 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(SerialiserType &ser, VkCommandBu
{
renderstate.colorWriteEnable.resize(pipeInfo.attachments.size());
for(size_t i = 0; i < renderstate.colorWriteEnable.size(); i++)
renderstate.colorWriteEnable[i] = pipeInfo.attachments[i].channelWriteMask != 0;
renderstate.colorWriteEnable[i] = pipeInfo.attachments[i].writeEnable;
}
if(!pipeInfo.dynamicStates[VkDynamicDepthBiasEnable])
{
Expand Down
Loading