From 08a0081c13c5ac37e4d419af384a9c86fcebca1b Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Thu, 31 Aug 2017 10:56:15 -0700 Subject: [PATCH] Change SetPipelineCommon to return void (#124) This is to avoid a potential future problem if SetPipelineCommon were to ever return false (which is currently not possible), some state might have been modified incorrectly. --- src/backend/CommandBufferStateTracker.cpp | 12 +++++++----- src/backend/CommandBufferStateTracker.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/backend/CommandBufferStateTracker.cpp b/src/backend/CommandBufferStateTracker.cpp index a957b7a1c8..2690041040 100644 --- a/src/backend/CommandBufferStateTracker.cpp +++ b/src/backend/CommandBufferStateTracker.cpp @@ -274,8 +274,10 @@ namespace backend { builder->HandleError("Can't use a compute pipeline while a render pass is active"); return false; } + aspects.set(VALIDATION_ASPECT_COMPUTE_PIPELINE); - return SetPipelineCommon(pipeline); + SetPipelineCommon(pipeline); + return true; } bool CommandBufferStateTracker::SetRenderPipeline(RenderPipelineBase* pipeline) { @@ -287,10 +289,11 @@ namespace backend { builder->HandleError("Pipeline is incompatible with this render pass"); return false; } + aspects.set(VALIDATION_ASPECT_RENDER_PIPELINE); lastRenderPipeline = pipeline; - - return SetPipelineCommon(pipeline); + SetPipelineCommon(pipeline); + return true; } bool CommandBufferStateTracker::SetBindGroup(uint32_t index, BindGroupBase* bindgroup) { @@ -526,7 +529,7 @@ namespace backend { return true; } - bool CommandBufferStateTracker::SetPipelineCommon(PipelineBase* pipeline) { + void CommandBufferStateTracker::SetPipelineCommon(PipelineBase* pipeline) { PipelineLayoutBase* layout = pipeline->GetLayout(); aspects.reset(VALIDATION_ASPECT_BIND_GROUPS); @@ -540,7 +543,6 @@ namespace backend { } lastPipeline = pipeline; - return true; } void CommandBufferStateTracker::UnsetPipeline() { diff --git a/src/backend/CommandBufferStateTracker.h b/src/backend/CommandBufferStateTracker.h index 43edbb8b87..888d7f3ef4 100644 --- a/src/backend/CommandBufferStateTracker.h +++ b/src/backend/CommandBufferStateTracker.h @@ -91,7 +91,7 @@ namespace backend { bool ValidateBindGroupUsages(BindGroupBase* group) const; bool RevalidateCanDraw(); - bool SetPipelineCommon(PipelineBase* pipeline); + void SetPipelineCommon(PipelineBase* pipeline); void UnsetPipeline(); CommandBufferBuilder* builder;