#ifndef SRC_DAWN_NATIVE_COMMANDVALIDATION_H_
#define SRC_DAWN_NATIVE_COMMANDVALIDATION_H_
#include <vector>
#include "absl/container/inlined_vector.h"
#include "dawn/common/Constants.h"
#include "dawn/native/CommandAllocator.h"
#include "dawn/native/Error.h"
#include "dawn/native/Features.h"
#include "dawn/native/Texture.h"
#include "dawn/native/UsageValidationMode.h"
namespace dawn::native {
enum class BufferSizeType { … };
class QuerySetBase;
struct SyncScopeResourceUsage;
struct TexelBlockInfo;
MaybeError ValidateSyncScopeResourceUsage(const SyncScopeResourceUsage& usage);
MaybeError ValidateTimestampQuery(const DeviceBase* device,
const QuerySetBase* querySet,
uint32_t queryIndex,
Feature requiredFeature = Feature::TimestampQuery);
MaybeError ValidatePassTimestampWrites(const DeviceBase* device,
const QuerySetBase* querySet,
uint32_t beginningOfPassWriteIndex,
uint32_t endOfPassWriteIndex);
MaybeError ValidateWriteBuffer(const DeviceBase* device,
const BufferBase* buffer,
uint64_t bufferOffset,
uint64_t size);
template <typename A, typename B>
DAWN_FORCE_INLINE uint64_t Safe32x32(A a, B b) { … }
ResultOrError<uint64_t> ComputeRequiredBytesInCopy(const TexelBlockInfo& blockInfo,
const Extent3D& copySize,
uint32_t bytesPerRow,
uint32_t rowsPerImage);
void ApplyDefaultTextureDataLayoutOptions(TextureDataLayout* layout,
const TexelBlockInfo& blockInfo,
const Extent3D& copyExtent);
MaybeError ValidateLinearTextureData(const TextureDataLayout& layout,
uint64_t byteSize,
const TexelBlockInfo& blockInfo,
const Extent3D& copyExtent);
MaybeError ValidateTextureCopyRange(DeviceBase const* device,
const ImageCopyTexture& imageCopyTexture,
const Extent3D& copySize);
ResultOrError<Aspect> SingleAspectUsedByImageCopyTexture(const ImageCopyTexture& view);
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst);
MaybeError ValidateImageCopyBuffer(DeviceBase const* device,
const ImageCopyBuffer& imageCopyBuffer);
MaybeError ValidateImageCopyTexture(DeviceBase const* device,
const ImageCopyTexture& imageCopyTexture,
const Extent3D& copySize);
MaybeError ValidateCopySizeFitsInBuffer(const Ref<BufferBase>& buffer,
uint64_t offset,
uint64_t size,
BufferSizeType checkBufferSizeType = BufferSizeType::Size);
bool IsRangeOverlapped(uint32_t startA, uint32_t startB, uint32_t length);
MaybeError ValidateTextureToTextureCopyCommonRestrictions(DeviceBase const* device,
const ImageCopyTexture& src,
const ImageCopyTexture& dst,
const Extent3D& copySize);
MaybeError ValidateTextureToTextureCopyRestrictions(DeviceBase const* device,
const ImageCopyTexture& src,
const ImageCopyTexture& dst,
const Extent3D& copySize);
MaybeError ValidateCanUseAs(const TextureBase* texture,
wgpu::TextureUsage usage,
UsageValidationMode mode);
MaybeError ValidateCanUseAs(const BufferBase* buffer, wgpu::BufferUsage usage);
MaybeError ValidateCanUseAsInternal(const BufferBase* buffer, wgpu::BufferUsage usage);
ColorAttachmentFormats;
MaybeError ValidateColorAttachmentBytesPerSample(DeviceBase* device,
const ColorAttachmentFormats& formats);
struct StorageAttachmentInfoForValidation { … };
MaybeError ValidatePLSInfo(
const DeviceBase* device,
uint64_t totalSize,
ityp::span<size_t, StorageAttachmentInfoForValidation> storageAttachments);
}
#endif