mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-21 03:11:36 +00:00
This makes a nearly one-to-one mapping between the JS and C APIs, which benefits projects like Blink and Emscripten. - JavaScript's `undefined` is equivalent to C `WGPU_STRIDE_UNDEFINED`. - JavaScript's `0` is equivalent to C `0`. - To implement the API correctly, Blink must special-case an actual value coming in from JS that is equal to WGPU_STRIDE_UNDEFINED (0xFFFF'FFFF), and inject an error. Keeps but deprecates a reasonable approximation of the old behavior. Bug: dawn:520 Change-Id: Ie9c992ffab82830090d0dfc3120731e89cd9691c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31140 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
100 lines
4.5 KiB
C++
100 lines
4.5 KiB
C++
// Copyright 2019 The Dawn Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#ifndef DAWNNATIVE_COMMANDVALIDATION_H_
|
|
#define DAWNNATIVE_COMMANDVALIDATION_H_
|
|
|
|
#include "dawn_native/CommandAllocator.h"
|
|
#include "dawn_native/Error.h"
|
|
#include "dawn_native/Texture.h"
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace dawn_native {
|
|
|
|
class AttachmentState;
|
|
class QuerySetBase;
|
|
struct BeginRenderPassCmd;
|
|
struct PassResourceUsage;
|
|
struct TexelBlockInfo;
|
|
|
|
using UsedQueryMap = std::map<QuerySetBase*, std::vector<bool>>;
|
|
|
|
MaybeError ValidateCanPopDebugGroup(uint64_t debugGroupStackSize);
|
|
MaybeError ValidateFinalDebugGroupStackSize(uint64_t debugGroupStackSize);
|
|
|
|
MaybeError ValidateRenderBundle(CommandIterator* commands,
|
|
const AttachmentState* attachmentState);
|
|
MaybeError ValidateRenderPass(CommandIterator* commands, const BeginRenderPassCmd* renderPass);
|
|
MaybeError ValidateComputePass(CommandIterator* commands);
|
|
|
|
MaybeError ValidatePassResourceUsage(const PassResourceUsage& usage);
|
|
|
|
MaybeError ValidateTimestampQuery(QuerySetBase* querySet,
|
|
uint32_t queryIndex,
|
|
const UsedQueryMap& usedQueryIndices);
|
|
|
|
ResultOrError<uint64_t> ComputeRequiredBytesInCopy(const TexelBlockInfo& blockInfo,
|
|
const Extent3D& copySize,
|
|
uint32_t bytesPerRow,
|
|
uint32_t rowsPerImage);
|
|
|
|
TextureDataLayout FixUpDeprecatedTextureDataLayoutOptions(
|
|
DeviceBase* device,
|
|
const TextureDataLayout& originalLayout,
|
|
const TexelBlockInfo& blockInfo,
|
|
const Extent3D& copyExtent);
|
|
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(const TextureCopyView& textureCopyView,
|
|
const Extent3D& copySize);
|
|
ResultOrError<Aspect> SingleAspectUsedByTextureCopyView(const TextureCopyView& view);
|
|
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const TextureCopyView& dst);
|
|
|
|
MaybeError ValidateBufferCopyView(DeviceBase const* device,
|
|
const BufferCopyView& bufferCopyView);
|
|
MaybeError ValidateTextureCopyView(DeviceBase const* device,
|
|
const TextureCopyView& textureCopyView,
|
|
const Extent3D& copySize);
|
|
|
|
MaybeError ValidateRowsPerImage(const Format& format,
|
|
uint32_t rowsPerImage,
|
|
uint32_t copyHeight);
|
|
MaybeError ValidateBytesPerRow(const Format& format,
|
|
const Extent3D& copySize,
|
|
uint32_t bytesPerRow);
|
|
MaybeError ValidateCopySizeFitsInBuffer(const Ref<BufferBase>& buffer,
|
|
uint64_t offset,
|
|
uint64_t size);
|
|
|
|
bool IsRangeOverlapped(uint32_t startA, uint32_t startB, uint32_t length);
|
|
|
|
MaybeError ValidateTextureToTextureCopyRestrictions(const TextureCopyView& src,
|
|
const TextureCopyView& dst,
|
|
const Extent3D& copySize);
|
|
|
|
MaybeError ValidateCanUseAs(const TextureBase* texture, wgpu::TextureUsage usage);
|
|
|
|
MaybeError ValidateCanUseAs(const BufferBase* buffer, wgpu::BufferUsage usage);
|
|
|
|
} // namespace dawn_native
|
|
|
|
#endif // DAWNNATIVE_COMMANDVALIDATION_H_
|