mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-01 19:03:41 +00:00
Make RenderPipeline::ValidateCompatibleWith produce an error message
Previously it would only return a boolean which made it difficult to know why the validation is failing. BUG=dawn:128 Change-Id: Id129a84f7777ba2efc5f12292aeccb83c076b9af Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8362 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
77aa5b59aa
commit
293ea7746d
@ -1199,11 +1199,7 @@ namespace dawn_native {
|
||||
SetRenderPipelineCmd* cmd = mIterator.NextCommand<SetRenderPipelineCmd>();
|
||||
RenderPipelineBase* pipeline = cmd->pipeline.Get();
|
||||
|
||||
if (!pipeline->IsCompatibleWith(renderPass)) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Pipeline is incompatible with this render pass");
|
||||
}
|
||||
|
||||
DAWN_TRY(pipeline->ValidateCompatibleWith(renderPass));
|
||||
persistentState.SetRenderPipeline(pipeline);
|
||||
} break;
|
||||
|
||||
|
@ -492,38 +492,43 @@ namespace dawn_native {
|
||||
return mSampleCount;
|
||||
}
|
||||
|
||||
bool RenderPipelineBase::IsCompatibleWith(const BeginRenderPassCmd* renderPass) const {
|
||||
MaybeError RenderPipelineBase::ValidateCompatibleWith(
|
||||
const BeginRenderPassCmd* renderPass) const {
|
||||
ASSERT(!IsError());
|
||||
// TODO(cwallez@chromium.org): This is called on every SetPipeline command. Optimize it for
|
||||
// example by caching some "attachment compatibility" object that would make the
|
||||
// compatibility check a single pointer comparison.
|
||||
|
||||
if (renderPass->colorAttachmentsSet != mColorAttachmentsSet) {
|
||||
return false;
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Pipeline doesn't have same color attachments set as renderPass");
|
||||
}
|
||||
|
||||
for (uint32_t i : IterateBitSet(mColorAttachmentsSet)) {
|
||||
if (renderPass->colorAttachments[i].view->GetFormat().format !=
|
||||
mColorStates[i].format) {
|
||||
return false;
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Pipeline color attachment format doesn't match renderPass");
|
||||
}
|
||||
}
|
||||
|
||||
if (renderPass->hasDepthStencilAttachment != mHasDepthStencilAttachment) {
|
||||
return false;
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Pipeline depth stencil attachment doesn't match renderPass");
|
||||
}
|
||||
|
||||
if (mHasDepthStencilAttachment &&
|
||||
(renderPass->depthStencilAttachment.view->GetFormat().format !=
|
||||
mDepthStencilState.format)) {
|
||||
return false;
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Pipeline depth stencil attachment format doesn't match renderPass");
|
||||
}
|
||||
|
||||
if (renderPass->sampleCount != mSampleCount) {
|
||||
return false;
|
||||
return DAWN_VALIDATION_ERROR("Pipeline sample count doesn't match renderPass");
|
||||
}
|
||||
|
||||
return true;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::bitset<kMaxVertexAttributes> RenderPipelineBase::GetAttributesUsingInput(
|
||||
|
@ -79,7 +79,7 @@ namespace dawn_native {
|
||||
|
||||
// A pipeline can be used in a render pass if its attachment info matches the actual
|
||||
// attachments in the render pass. This returns whether it is the case.
|
||||
bool IsCompatibleWith(const BeginRenderPassCmd* renderPassCmd) const;
|
||||
MaybeError ValidateCompatibleWith(const BeginRenderPassCmd* renderPassCmd) const;
|
||||
std::bitset<kMaxVertexAttributes> GetAttributesUsingInput(uint32_t slot) const;
|
||||
std::array<std::bitset<kMaxVertexAttributes>, kMaxVertexBuffers> attributesUsingInput;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user