#include "dawn/native/utils/WGPUHelpers.h"
#include <cstring>
#include <iomanip>
#include <limits>
#include <mutex>
#include <sstream>
#include "dawn/common/Assert.h"
#include "dawn/common/Constants.h"
#include "dawn/native/BindGroup.h"
#include "dawn/native/BindGroupLayout.h"
#include "dawn/native/Buffer.h"
#include "dawn/native/Device.h"
#include "dawn/native/ExternalTexture.h"
#include "dawn/native/PipelineLayout.h"
#include "dawn/native/Queue.h"
#include "dawn/native/Sampler.h"
#include "dawn/native/ShaderModule.h"
namespace dawn::native::utils {
ResultOrError<Ref<ShaderModuleBase>> CreateShaderModule(
DeviceBase* device,
const char* source,
const std::vector<tint::wgsl::Extension>& internalExtensions) { … }
ResultOrError<Ref<BufferBase>> CreateBufferFromData(DeviceBase* device,
wgpu::BufferUsage usage,
const void* data,
uint64_t size) { … }
ResultOrError<Ref<PipelineLayoutBase>> MakeBasicPipelineLayout(
DeviceBase* device,
const Ref<BindGroupLayoutBase>& bindGroupLayout) { … }
ResultOrError<Ref<BindGroupLayoutBase>> MakeBindGroupLayout(
DeviceBase* device,
std::initializer_list<BindingLayoutEntryInitializationHelper> entriesInitializer,
bool allowInternalBinding) { … }
BindingLayoutEntryInitializationHelper::BindingLayoutEntryInitializationHelper(
uint32_t entryBinding,
wgpu::ShaderStage entryVisibility,
wgpu::BufferBindingType bufferType,
bool bufferHasDynamicOffset,
uint64_t bufferMinBindingSize) { … }
BindingLayoutEntryInitializationHelper::BindingLayoutEntryInitializationHelper(
uint32_t entryBinding,
wgpu::ShaderStage entryVisibility,
wgpu::SamplerBindingType samplerType) { … }
BindingLayoutEntryInitializationHelper::BindingLayoutEntryInitializationHelper(
uint32_t entryBinding,
wgpu::ShaderStage entryVisibility,
wgpu::TextureSampleType textureSampleType,
wgpu::TextureViewDimension textureViewDimension,
bool textureMultisampled) { … }
BindingLayoutEntryInitializationHelper::BindingLayoutEntryInitializationHelper(
uint32_t entryBinding,
wgpu::ShaderStage entryVisibility,
wgpu::StorageTextureAccess storageTextureAccess,
wgpu::TextureFormat format,
wgpu::TextureViewDimension textureViewDimension) { … }
BindingLayoutEntryInitializationHelper::BindingLayoutEntryInitializationHelper(
const BindGroupLayoutEntry& entry)
: … { … }
BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
const Ref<SamplerBase>& sampler)
: … { … }
BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
const Ref<TextureViewBase>& textureView)
: … { … }
BindingInitializationHelper::BindingInitializationHelper(
uint32_t binding,
const Ref<ExternalTextureBase>& externalTexture)
: … { … }
BindingInitializationHelper::BindingInitializationHelper(uint32_t binding,
const Ref<BufferBase>& buffer,
uint64_t offset,
uint64_t size)
: … { … }
BindingInitializationHelper::~BindingInitializationHelper() = default;
BindGroupEntry BindingInitializationHelper::GetAsBinding() const { … }
ResultOrError<Ref<BindGroupBase>> MakeBindGroup(
DeviceBase* device,
const Ref<BindGroupLayoutBase>& layout,
std::initializer_list<BindingInitializationHelper> entriesInitializer,
UsageValidationMode mode) { … }
const char* GetLabelForTrace(const char* label) { … }
std::string_view NormalizeLabel(std::string_view in) { … }
std::string_view NormalizeLabel(std::optional<std::string_view> in) { … }
}