Skip to content

Commit ea1e2cf

Browse files
committed
encode: fixups for encode: remove the CPU
- revert dumpShaders debug flag to false - fix pushConstantRange size to match shader layout: Use sizeof(PushConstants) to keep the pipeline layout size in sync with the C++ struct automatically, as done in nvpro commit c2a2fc0 ("common: Optimize shader by precomputing half-resolution in push constants"). Fixes VUID-vkCmdPushConstants-offset-01795 reported by the Vulkan Validation Layers when running the encoder with the compute filter enabled (SHADERC_SUPPORT). - YcbcrUtils: add assert for unknown bpp in GetBitsPerChannel Function added in 8f6be61 silently returns 8 for unrecognized bpp values. Add assert to catch misuse in debug builds.
1 parent 935906a commit ea1e2cf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

common/include/nvidia_utils/vulkan/ycbcr_utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ static inline uint32_t GetBitsPerChannel(const YcbcrPlanesLayoutInfo& pYcbcrPlan
117117
case YCBCRA_16BPP:
118118
return 16;
119119
default:
120+
assert(!"Unknown bpp value in GetBitsPerChannel");
120121
return 8;
121122
}
122123
}

common/libs/VkCodecUtils/VulkanFilterYuvCompute.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "VulkanFilterYuvCompute.h"
1818
#include "nvidia_utils/vulkan/ycbcrvkinfo.h"
1919

20-
static bool dumpShaders = true;
20+
static bool dumpShaders = false;
2121

2222
VkResult VulkanFilterYuvCompute::Create(const VulkanDeviceContext* vkDevCtx,
2323
uint32_t queueFamilyIndex,
@@ -176,7 +176,7 @@ VkResult VulkanFilterYuvCompute::InitDescriptorSetLayout(uint32_t maxNumFrames)
176176
VkPushConstantRange pushConstantRange = {};
177177
pushConstantRange.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT; // Stage the push constant is for
178178
pushConstantRange.offset = 0;
179-
pushConstantRange.size = 6 * sizeof(uint32_t); // Size of the push constant - source and destination image layers + 2 * ivec2
179+
pushConstantRange.size = sizeof(PushConstants); // Size of the push constant - source and destination image layers + 2 * ivec2
180180

181181
return m_descriptorSetLayout.CreateDescriptorSet(m_vkDevCtx,
182182
setLayoutBindings,

0 commit comments

Comments
 (0)