MCPcopy Create free account
hub / github.com/baldurk/renderdoc / FillWithDiscardPattern

Method FillWithDiscardPattern

renderdoc/driver/vulkan/vk_debug.cpp:2171–2633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2169}
2170
2171void VulkanDebugManager::FillWithDiscardPattern(VkCommandBuffer cmd, DiscardType type,
2172 VkImage image, VkImageLayout curLayout,
2173 VkImageSubresourceRange discardRange,
2174 VkRect2D discardRect)
2175{
2176 // State tracking will not be accurate during loading
2177 if(IsLoading(m_pDriver->m_State))
2178 return;
2179
2180 VkDevice dev = m_Device;
2181 const VkDevDispatchTable *vt = ObjDisp(dev);
2182 const VulkanCreationInfo::Image &imInfo = GetImageInfo(GetResID(image));
2183
2184 VkMarkerRegion marker(
2185 cmd, StringFormat::Fmt("FillWithDiscardPattern %s", ToStr(GetResID(image)).c_str()));
2186
2187 const VkImageAspectFlags imAspects = FormatImageAspects(imInfo.format);
2188
2189 VkImageSubresourceRange barrierDiscardRange = discardRange;
2190 barrierDiscardRange.aspectMask = imAspects;
2191
2192 if(imInfo.samples > 1)
2193 {
2194 WrappedVulkan *driver = m_pDriver;
2195
2196 // MSAA requires a graphics queue
2197 if((driver->GetCommandType() & VK_QUEUE_GRAPHICS_BIT) == 0)
2198 return;
2199
2200 bool depth = false;
2201 if(IsDepthOrStencilFormat(imInfo.format))
2202 depth = true;
2203
2204 rdcpair<VkFormat, VkSampleCountFlagBits> key = {imInfo.format, imInfo.samples};
2205
2206 DiscardPassData &passdata = m_DiscardPipes[key];
2207
2208 // create and cache a pipeline and RP that writes to this format and sample count
2209 if(passdata.pso[0] == VK_NULL_HANDLE)
2210 {
2211 BuiltinShaderBaseType baseType = BuiltinShaderBaseType::Float;
2212
2213 if(IsSIntFormat(imInfo.format))
2214 baseType = BuiltinShaderBaseType::SInt;
2215 else if(IsUIntFormat(imInfo.format))
2216 baseType = BuiltinShaderBaseType::UInt;
2217
2218 VkAttachmentReference attRef = {
2219 0,
2220 depth ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
2221 : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
2222 };
2223
2224 VkAttachmentDescription attDesc = {
2225 0,
2226 imInfo.format,
2227 imInfo.samples,
2228 VK_ATTACHMENT_LOAD_OP_LOAD,

Calls 15

IsLoadingFunction · 0.85
ObjDispFunction · 0.85
FmtFunction · 0.85
ToStrFunction · 0.85
FormatImageAspectsFunction · 0.85
NameVulkanObjectFunction · 0.85
UnwrapPtrFunction · 0.85
RDCMINFunction · 0.85
DoPipelineBarrierFunction · 0.85
GetDiscardPatternFunction · 0.85
vkCreateRenderPassMethod · 0.80

Tested by

no test coverage detected