mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
Add InjectValidationError to command encoder
Needed to implement bytesPerRow/rowsPerImage validation in Blink. Bug: dawn:566 Change-Id: I60e9ebd57e40d5043e7277cdc560cbf673bc2576 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32582 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
b38a9c3ee7
commit
464aaeb558
@@ -712,6 +712,12 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void CommandEncoder::InjectValidationError(const char* message) {
|
||||
if (mEncodingContext.CheckCurrentEncoder(this)) {
|
||||
mEncodingContext.HandleError(InternalErrorType::Validation, message);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandEncoder::InsertDebugMarker(const char* groupLabel) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
InsertDebugMarkerCmd* cmd =
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace dawn_native {
|
||||
const TextureCopyView* destination,
|
||||
const Extent3D* copySize);
|
||||
|
||||
void InjectValidationError(const char* message);
|
||||
void InsertDebugMarker(const char* groupLabel);
|
||||
void PopDebugGroup();
|
||||
void PushDebugGroup(const char* groupLabel);
|
||||
|
||||
@@ -55,6 +55,8 @@ namespace dawn_native {
|
||||
|
||||
void EncodingContext::HandleError(InternalErrorType type, const char* message) {
|
||||
if (!IsFinished()) {
|
||||
// Encoding should only generate validation errors.
|
||||
ASSERT(type == InternalErrorType::Validation);
|
||||
// If the encoding context is not finished, errors are deferred until
|
||||
// Finish() is called.
|
||||
if (!mGotError) {
|
||||
|
||||
@@ -53,8 +53,7 @@ namespace dawn_native {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename EncodeFunction>
|
||||
inline bool TryEncode(const ObjectBase* encoder, EncodeFunction&& encodeFunction) {
|
||||
inline bool CheckCurrentEncoder(const ObjectBase* encoder) {
|
||||
if (DAWN_UNLIKELY(encoder != mCurrentEncoder)) {
|
||||
if (mCurrentEncoder != mTopLevelEncoder) {
|
||||
// The top level encoder was used when a pass encoder was current.
|
||||
@@ -66,6 +65,14 @@ namespace dawn_native {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename EncodeFunction>
|
||||
inline bool TryEncode(const ObjectBase* encoder, EncodeFunction&& encodeFunction) {
|
||||
if (!CheckCurrentEncoder(encoder)) {
|
||||
return false;
|
||||
}
|
||||
ASSERT(!mWasMovedToIterator);
|
||||
return !ConsumedError(encodeFunction(&mAllocator));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user