#include "dawn/native/CommandBufferStateTracker.h"
#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include <variant>
#include "absl/container/flat_hash_map.h"
#include "absl/container/inlined_vector.h"
#include "dawn/common/Assert.h"
#include "dawn/common/BitSetIterator.h"
#include "dawn/native/BindGroup.h"
#include "dawn/native/ComputePassEncoder.h"
#include "dawn/native/ComputePipeline.h"
#include "dawn/native/Forward.h"
#include "dawn/native/ObjectType_autogen.h"
#include "dawn/native/PipelineLayout.h"
#include "dawn/native/RenderPipeline.h"
namespace dawn::native {
namespace {
std::optional<uint32_t> FindFirstUndersizedBuffer(
const ityp::span<uint32_t, uint64_t> unverifiedBufferSizes,
const std::vector<uint64_t>& pipelineMinBufferSizes) { … }
struct BufferAliasing { … };
struct TextureAliasing { … };
WritableBindingAliasingResult;
template <typename Return>
Return FindStorageBufferBindingAliasing(const PipelineLayoutBase* pipelineLayout,
const PerBindGroup<BindGroupBase*>& bindGroups,
const PerBindGroup<std::vector<uint32_t>>& dynamicOffsets) { … }
bool TextureViewsMatch(const TextureViewBase* a, const TextureViewBase* b) { … }
VectorOfTextureViews;
bool TextureViewsAllMatch(const VectorOfTextureViews& views) { … }
}
enum ValidationAspect { … };
static_assert …;
static constexpr CommandBufferStateTracker::ValidationAspects kDispatchAspects = …;
static constexpr CommandBufferStateTracker::ValidationAspects kDrawAspects = …;
static constexpr CommandBufferStateTracker::ValidationAspects kDrawIndexedAspects = …;
static constexpr CommandBufferStateTracker::ValidationAspects kLazyAspects = …;
CommandBufferStateTracker::CommandBufferStateTracker() = default;
CommandBufferStateTracker::CommandBufferStateTracker(const CommandBufferStateTracker&) = default;
CommandBufferStateTracker::CommandBufferStateTracker(CommandBufferStateTracker&&) = default;
CommandBufferStateTracker::~CommandBufferStateTracker() = default;
CommandBufferStateTracker& CommandBufferStateTracker::operator=(const CommandBufferStateTracker&) =
default;
CommandBufferStateTracker& CommandBufferStateTracker::operator=(CommandBufferStateTracker&&) =
default;
MaybeError CommandBufferStateTracker::ValidateCanDispatch() { … }
MaybeError CommandBufferStateTracker::ValidateCanDraw() { … }
MaybeError CommandBufferStateTracker::ValidateCanDrawIndexed() { … }
MaybeError CommandBufferStateTracker::ValidateNoDifferentTextureViewsOnSameTexture() { … }
MaybeError CommandBufferStateTracker::ValidateBufferInRangeForVertexBuffer(uint32_t vertexCount,
uint32_t firstVertex) { … }
MaybeError CommandBufferStateTracker::ValidateBufferInRangeForInstanceBuffer(
uint32_t instanceCount,
uint32_t firstInstance) { … }
MaybeError CommandBufferStateTracker::ValidateIndexBufferInRange(uint32_t indexCount,
uint32_t firstIndex) { … }
MaybeError CommandBufferStateTracker::ValidateOperation(ValidationAspects requiredAspects) { … }
void CommandBufferStateTracker::RecomputeLazyAspects(ValidationAspects aspects) { … }
MaybeError CommandBufferStateTracker::CheckMissingAspects(ValidationAspects aspects) { … }
void CommandBufferStateTracker::SetComputePipeline(ComputePipelineBase* pipeline) { … }
void CommandBufferStateTracker::SetRenderPipeline(RenderPipelineBase* pipeline) { … }
void CommandBufferStateTracker::UnsetBindGroup(BindGroupIndex index) { … }
void CommandBufferStateTracker::SetBindGroup(BindGroupIndex index,
BindGroupBase* bindgroup,
uint32_t dynamicOffsetCount,
const uint32_t* dynamicOffsets) { … }
void CommandBufferStateTracker::SetIndexBuffer(BufferBase* buffer,
wgpu::IndexFormat format,
uint64_t offset,
uint64_t size) { … }
void CommandBufferStateTracker::UnsetVertexBuffer(VertexBufferSlot slot) { … }
void CommandBufferStateTracker::SetVertexBuffer(VertexBufferSlot slot, uint64_t size) { … }
void CommandBufferStateTracker::SetPipelineCommon(PipelineBase* pipeline) { … }
BindGroupBase* CommandBufferStateTracker::GetBindGroup(BindGroupIndex index) const { … }
const std::vector<uint32_t>& CommandBufferStateTracker::GetDynamicOffsets(
BindGroupIndex index) const { … }
bool CommandBufferStateTracker::HasPipeline() const { … }
bool CommandBufferStateTracker::IndexBufferSet() const { … }
RenderPipelineBase* CommandBufferStateTracker::GetRenderPipeline() const { … }
ComputePipelineBase* CommandBufferStateTracker::GetComputePipeline() const { … }
PipelineLayoutBase* CommandBufferStateTracker::GetPipelineLayout() const { … }
BufferBase* CommandBufferStateTracker::GetIndexBuffer() const { … }
wgpu::IndexFormat CommandBufferStateTracker::GetIndexFormat() const { … }
uint64_t CommandBufferStateTracker::GetIndexBufferSize() const { … }
uint64_t CommandBufferStateTracker::GetIndexBufferOffset() const { … }
void CommandBufferStateTracker::End() { … }
}