Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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: 3 additions & 3 deletions src/igl/vulkan/RenderCommandEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void RenderCommandEncoder::initialize(const RenderPassDesc& renderPass,

const auto renderPassHandle = ctx_.findRenderPass(builder);

dynamicState_.renderPassIndex = renderPassHandle.index;
renderPass_ = renderPassHandle.pass;
dynamicState_.depthBiasEnable = false;

const VkRenderPassBeginInfo bi = fb.getRenderPassBeginInfo(
Expand Down Expand Up @@ -608,7 +608,7 @@ void RenderCommandEncoder::bindPushConstants(const void* data, size_t length, si

if (!rps_->pipelineLayout) {
// bring a pipeline layout into existence - we don't really care about the dynamic state here
(void)rps_->getVkPipeline(dynamicState_);
(void)rps_->getVkPipeline(dynamicState_, renderPass_);
}

#if IGL_VULKAN_PRINT_COMMANDS
Expand Down Expand Up @@ -917,7 +917,7 @@ void RenderCommandEncoder::flushDynamicDepthStencilState() {
void RenderCommandEncoder::flushDynamicState() {
IGL_PROFILER_FUNCTION();

binder_.bindPipeline(rps_->getVkPipeline(dynamicState_), &rps_->getSpvModuleInfo());
binder_.bindPipeline(rps_->getVkPipeline(dynamicState_, renderPass_), &rps_->getSpvModuleInfo());

flushDynamicDepthStencilState();

Expand Down
1 change: 1 addition & 0 deletions src/igl/vulkan/RenderCommandEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class RenderCommandEncoder : public IRenderCommandEncoder {
private:
VulkanContext& ctx_;
VkCommandBuffer cmdBuffer_ = VK_NULL_HANDLE;
VkRenderPass renderPass_ = VK_NULL_HANDLE;
bool isEncoding_ = false;
bool hasDepthAttachment_ = false;
std::shared_ptr<IFramebuffer> framebuffer_;
Expand Down
5 changes: 2 additions & 3 deletions src/igl/vulkan/RenderPipelineState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ RenderPipelineState::~RenderPipelineState() {

// NOLINTNEXTLINE(facebook-hte-NullableReturn)
VkPipeline RenderPipelineState::getVkPipeline(
const RenderPipelineDynamicState& dynamicState) const {
const RenderPipelineDynamicState& dynamicState,
VkRenderPass renderPass) const {
const VulkanContext& ctx = device_.getVulkanContext();
IGL_ENSURE_VULKAN_CONTEXT_THREAD(&ctx);

Expand Down Expand Up @@ -439,8 +440,6 @@ VkPipeline RenderPipelineState::getVkPipeline(
deviceFeatures.vkPhysicalDeviceFeatures2.features.dualSrcBlend;

// build a new Vulkan pipeline
const VkRenderPass renderPass = ctx.getRenderPass(dynamicState.renderPassIndex).pass;

VkPipeline pipeline = VK_NULL_HANDLE;

const VkPipelineCreateFlags flags = ctx.features().has_VK_EXT_descriptor_buffer
Expand Down
7 changes: 2 additions & 5 deletions src/igl/vulkan/RenderPipelineState.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ class alignas(sizeof(uint64_t)) RenderPipelineDynamicState {
uint32_t stencilBackCompareOp_ : 3;

public:
// Ignore modernize-use-default-member-init
// @lint-ignore CLANGTIDY
uint32_t renderPassIndex : 8;
// Ignore modernize-use-default-member-init
// @lint-ignore CLANGTIDY
uint32_t depthBiasEnable : 1;
Expand All @@ -85,7 +82,6 @@ class alignas(sizeof(uint64_t)) RenderPipelineDynamicState {
stencilBackPassOp_ = VK_STENCIL_OP_KEEP;
stencilBackDepthFailOp_ = VK_STENCIL_OP_KEEP;
stencilBackCompareOp_ = VK_COMPARE_OP_ALWAYS;
renderPassIndex = 0;
depthBiasEnable = false;
depthWriteEnable = false;
stencilTestEnable = false;
Expand Down Expand Up @@ -177,7 +173,8 @@ class RenderPipelineState final : public IRenderPipelineState, public PipelineSt
* mutable ones provided in the `dynamicState` parameter. If a pipeline layout change is detected,
* all cached pipelines are discarded.
*/
[[nodiscard]] VkPipeline getVkPipeline(const RenderPipelineDynamicState& dynamicState) const;
[[nodiscard]] VkPipeline getVkPipeline(const RenderPipelineDynamicState& dynamicState,
VkRenderPass renderPass) const;

private:
friend class Device;
Expand Down
Loading