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.
This commit is contained in:
Kai Ninomiya 2017-08-31 10:56:15 -07:00 committed by GitHub
parent da42198478
commit 08a0081c13
2 changed files with 8 additions and 6 deletions

View File

@ -274,8 +274,10 @@ namespace backend {
builder->HandleError("Can't use a compute pipeline while a render pass is active"); builder->HandleError("Can't use a compute pipeline while a render pass is active");
return false; return false;
} }
aspects.set(VALIDATION_ASPECT_COMPUTE_PIPELINE); aspects.set(VALIDATION_ASPECT_COMPUTE_PIPELINE);
return SetPipelineCommon(pipeline); SetPipelineCommon(pipeline);
return true;
} }
bool CommandBufferStateTracker::SetRenderPipeline(RenderPipelineBase* pipeline) { bool CommandBufferStateTracker::SetRenderPipeline(RenderPipelineBase* pipeline) {
@ -287,10 +289,11 @@ namespace backend {
builder->HandleError("Pipeline is incompatible with this render pass"); builder->HandleError("Pipeline is incompatible with this render pass");
return false; return false;
} }
aspects.set(VALIDATION_ASPECT_RENDER_PIPELINE); aspects.set(VALIDATION_ASPECT_RENDER_PIPELINE);
lastRenderPipeline = pipeline; lastRenderPipeline = pipeline;
SetPipelineCommon(pipeline);
return SetPipelineCommon(pipeline); return true;
} }
bool CommandBufferStateTracker::SetBindGroup(uint32_t index, BindGroupBase* bindgroup) { bool CommandBufferStateTracker::SetBindGroup(uint32_t index, BindGroupBase* bindgroup) {
@ -526,7 +529,7 @@ namespace backend {
return true; return true;
} }
bool CommandBufferStateTracker::SetPipelineCommon(PipelineBase* pipeline) { void CommandBufferStateTracker::SetPipelineCommon(PipelineBase* pipeline) {
PipelineLayoutBase* layout = pipeline->GetLayout(); PipelineLayoutBase* layout = pipeline->GetLayout();
aspects.reset(VALIDATION_ASPECT_BIND_GROUPS); aspects.reset(VALIDATION_ASPECT_BIND_GROUPS);
@ -540,7 +543,6 @@ namespace backend {
} }
lastPipeline = pipeline; lastPipeline = pipeline;
return true;
} }
void CommandBufferStateTracker::UnsetPipeline() { void CommandBufferStateTracker::UnsetPipeline() {

View File

@ -91,7 +91,7 @@ namespace backend {
bool ValidateBindGroupUsages(BindGroupBase* group) const; bool ValidateBindGroupUsages(BindGroupBase* group) const;
bool RevalidateCanDraw(); bool RevalidateCanDraw();
bool SetPipelineCommon(PipelineBase* pipeline); void SetPipelineCommon(PipelineBase* pipeline);
void UnsetPipeline(); void UnsetPipeline();
CommandBufferBuilder* builder; CommandBufferBuilder* builder;