From 6366a019db85a5588b97e5867d9c43ba71c9d09f Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 3 Aug 2017 16:14:30 -0400 Subject: [PATCH] Validate render subpass for SetBlendColor and SetStencilReference --- src/backend/CommandBuffer.cpp | 8 ++++---- src/backend/CommandBufferStateTracker.cpp | 4 ++++ src/backend/CommandBufferStateTracker.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/backend/CommandBuffer.cpp b/src/backend/CommandBuffer.cpp index 5159c2f5b2..011daf1b88 100644 --- a/src/backend/CommandBuffer.cpp +++ b/src/backend/CommandBuffer.cpp @@ -573,8 +573,8 @@ namespace backend { case Command::SetStencilReference: { iterator.NextCommand(); - if (!state->HaveRenderPass()) { - HandleError("Can't set stencil reference without an active render pass"); + if (!state->HaveRenderSubpass()) { + HandleError("Can't set stencil reference without an active render subpass"); return false; } } @@ -583,8 +583,8 @@ namespace backend { case Command::SetBlendColor: { iterator.NextCommand(); - if (!state->HaveRenderPass()) { - HandleError("Can't set blend color without an active render pass"); + if (!state->HaveRenderSubpass()) { + HandleError("Can't set blend color without an active render subpass"); return false; } } diff --git a/src/backend/CommandBufferStateTracker.cpp b/src/backend/CommandBufferStateTracker.cpp index 51087fc871..e0bc4c64d8 100644 --- a/src/backend/CommandBufferStateTracker.cpp +++ b/src/backend/CommandBufferStateTracker.cpp @@ -37,6 +37,10 @@ namespace backend { return currentRenderPass != nullptr; } + bool CommandBufferStateTracker::HaveRenderSubpass() const { + return aspects[VALIDATION_ASPECT_RENDER_SUBPASS]; + } + bool CommandBufferStateTracker::ValidateCanCopy() const { if (currentRenderPass) { builder->HandleError("Copy cannot occur during a render pass"); diff --git a/src/backend/CommandBufferStateTracker.h b/src/backend/CommandBufferStateTracker.h index aaa26ade8a..43edbb8b87 100644 --- a/src/backend/CommandBufferStateTracker.h +++ b/src/backend/CommandBufferStateTracker.h @@ -30,6 +30,7 @@ namespace backend { // Non-state-modifying validation functions bool HaveRenderPass() const; + bool HaveRenderSubpass() const; bool ValidateCanCopy() const; bool ValidateCanUseBufferAs(BufferBase* buffer, nxt::BufferUsageBit usage) const; bool ValidateCanUseTextureAs(TextureBase* texture, nxt::TextureUsageBit usage) const;