[tint] Introduce an ast::transform namespace
All AST transforms live inside this namespace. There will be a corresponding ir::transform namespace for IR transforms. Change-Id: I543972451c08e7df5632b835257999a8af3701d1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132424 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
parent
7351fb31c8
commit
b4acbb8bb0
|
@ -1012,12 +1012,12 @@ RequiredBufferSizes ComputeRequiredBufferSizesForLayout(const EntryPointMetadata
|
|||
return bufferSizes;
|
||||
}
|
||||
|
||||
ResultOrError<tint::Program> RunTransforms(tint::transform::Transform* transform,
|
||||
ResultOrError<tint::Program> RunTransforms(tint::ast::transform::Transform* transform,
|
||||
const tint::Program* program,
|
||||
const tint::transform::DataMap& inputs,
|
||||
tint::transform::DataMap* outputs,
|
||||
const tint::ast::transform::DataMap& inputs,
|
||||
tint::ast::transform::DataMap* outputs,
|
||||
OwnedCompilationMessages* outMessages) {
|
||||
tint::transform::Output output = transform->Run(program, inputs);
|
||||
tint::ast::transform::Output output = transform->Run(program, inputs);
|
||||
if (outMessages != nullptr) {
|
||||
DAWN_TRY(outMessages->AddMessages(output.program.Diagnostics()));
|
||||
}
|
||||
|
|
|
@ -44,11 +44,14 @@ namespace tint {
|
|||
|
||||
class Program;
|
||||
|
||||
namespace transform {
|
||||
namespace ast::transform {
|
||||
class DataMap;
|
||||
class Manager;
|
||||
class Transform;
|
||||
class VertexPulling;
|
||||
} // namespace ast::transform
|
||||
|
||||
namespace transform {
|
||||
class Manager;
|
||||
} // namespace transform
|
||||
|
||||
} // namespace tint
|
||||
|
@ -118,10 +121,10 @@ ResultOrError<Extent3D> ValidateComputeStageWorkgroupSize(
|
|||
|
||||
RequiredBufferSizes ComputeRequiredBufferSizesForLayout(const EntryPointMetadata& entryPoint,
|
||||
const PipelineLayoutBase* layout);
|
||||
ResultOrError<tint::Program> RunTransforms(tint::transform::Transform* transform,
|
||||
ResultOrError<tint::Program> RunTransforms(tint::ast::transform::Transform* transform,
|
||||
const tint::Program* program,
|
||||
const tint::transform::DataMap& inputs,
|
||||
tint::transform::DataMap* outputs,
|
||||
const tint::ast::transform::DataMap& inputs,
|
||||
tint::ast::transform::DataMap* outputs,
|
||||
OwnedCompilationMessages* messages);
|
||||
|
||||
// Mirrors wgpu::SamplerBindingLayout but instead stores a single boolean
|
||||
|
|
|
@ -67,17 +67,17 @@ void stream::Stream<tint::writer::ExternalTextureOptions>::Write(
|
|||
|
||||
// static
|
||||
template <>
|
||||
void stream::Stream<tint::transform::VertexPulling::Config>::Write(
|
||||
void stream::Stream<tint::ast::transform::VertexPulling::Config>::Write(
|
||||
stream::Sink* sink,
|
||||
const tint::transform::VertexPulling::Config& cfg) {
|
||||
const tint::ast::transform::VertexPulling::Config& cfg) {
|
||||
StreamInTintObject(cfg, sink);
|
||||
}
|
||||
|
||||
// static
|
||||
template <>
|
||||
void stream::Stream<tint::transform::SubstituteOverride::Config>::Write(
|
||||
void stream::Stream<tint::ast::transform::SubstituteOverride::Config>::Write(
|
||||
stream::Sink* sink,
|
||||
const tint::transform::SubstituteOverride::Config& cfg) {
|
||||
const tint::ast::transform::SubstituteOverride::Config& cfg) {
|
||||
StreamInTintObject(cfg, sink);
|
||||
}
|
||||
|
||||
|
@ -89,17 +89,17 @@ void stream::Stream<tint::OverrideId>::Write(stream::Sink* sink, const tint::Ove
|
|||
|
||||
// static
|
||||
template <>
|
||||
void stream::Stream<tint::transform::VertexBufferLayoutDescriptor>::Write(
|
||||
void stream::Stream<tint::ast::transform::VertexBufferLayoutDescriptor>::Write(
|
||||
stream::Sink* sink,
|
||||
const tint::transform::VertexBufferLayoutDescriptor& layout) {
|
||||
const tint::ast::transform::VertexBufferLayoutDescriptor& layout) {
|
||||
StreamInTintObject(layout, sink);
|
||||
}
|
||||
|
||||
// static
|
||||
template <>
|
||||
void stream::Stream<tint::transform::VertexAttributeDescriptor>::Write(
|
||||
void stream::Stream<tint::ast::transform::VertexAttributeDescriptor>::Write(
|
||||
stream::Sink* sink,
|
||||
const tint::transform::VertexAttributeDescriptor& attrib) {
|
||||
const tint::ast::transform::VertexAttributeDescriptor& attrib) {
|
||||
StreamInTintObject(attrib, sink);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,68 +48,68 @@ bool InitializeTintErrorReporter() {
|
|||
return true;
|
||||
}
|
||||
|
||||
tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) {
|
||||
tint::ast::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::VertexFormat::Uint8x2:
|
||||
return tint::transform::VertexFormat::kUint8x2;
|
||||
return tint::ast::transform::VertexFormat::kUint8x2;
|
||||
case wgpu::VertexFormat::Uint8x4:
|
||||
return tint::transform::VertexFormat::kUint8x4;
|
||||
return tint::ast::transform::VertexFormat::kUint8x4;
|
||||
case wgpu::VertexFormat::Sint8x2:
|
||||
return tint::transform::VertexFormat::kSint8x2;
|
||||
return tint::ast::transform::VertexFormat::kSint8x2;
|
||||
case wgpu::VertexFormat::Sint8x4:
|
||||
return tint::transform::VertexFormat::kSint8x4;
|
||||
return tint::ast::transform::VertexFormat::kSint8x4;
|
||||
case wgpu::VertexFormat::Unorm8x2:
|
||||
return tint::transform::VertexFormat::kUnorm8x2;
|
||||
return tint::ast::transform::VertexFormat::kUnorm8x2;
|
||||
case wgpu::VertexFormat::Unorm8x4:
|
||||
return tint::transform::VertexFormat::kUnorm8x4;
|
||||
return tint::ast::transform::VertexFormat::kUnorm8x4;
|
||||
case wgpu::VertexFormat::Snorm8x2:
|
||||
return tint::transform::VertexFormat::kSnorm8x2;
|
||||
return tint::ast::transform::VertexFormat::kSnorm8x2;
|
||||
case wgpu::VertexFormat::Snorm8x4:
|
||||
return tint::transform::VertexFormat::kSnorm8x4;
|
||||
return tint::ast::transform::VertexFormat::kSnorm8x4;
|
||||
case wgpu::VertexFormat::Uint16x2:
|
||||
return tint::transform::VertexFormat::kUint16x2;
|
||||
return tint::ast::transform::VertexFormat::kUint16x2;
|
||||
case wgpu::VertexFormat::Uint16x4:
|
||||
return tint::transform::VertexFormat::kUint16x4;
|
||||
return tint::ast::transform::VertexFormat::kUint16x4;
|
||||
case wgpu::VertexFormat::Sint16x2:
|
||||
return tint::transform::VertexFormat::kSint16x2;
|
||||
return tint::ast::transform::VertexFormat::kSint16x2;
|
||||
case wgpu::VertexFormat::Sint16x4:
|
||||
return tint::transform::VertexFormat::kSint16x4;
|
||||
return tint::ast::transform::VertexFormat::kSint16x4;
|
||||
case wgpu::VertexFormat::Unorm16x2:
|
||||
return tint::transform::VertexFormat::kUnorm16x2;
|
||||
return tint::ast::transform::VertexFormat::kUnorm16x2;
|
||||
case wgpu::VertexFormat::Unorm16x4:
|
||||
return tint::transform::VertexFormat::kUnorm16x4;
|
||||
return tint::ast::transform::VertexFormat::kUnorm16x4;
|
||||
case wgpu::VertexFormat::Snorm16x2:
|
||||
return tint::transform::VertexFormat::kSnorm16x2;
|
||||
return tint::ast::transform::VertexFormat::kSnorm16x2;
|
||||
case wgpu::VertexFormat::Snorm16x4:
|
||||
return tint::transform::VertexFormat::kSnorm16x4;
|
||||
return tint::ast::transform::VertexFormat::kSnorm16x4;
|
||||
case wgpu::VertexFormat::Float16x2:
|
||||
return tint::transform::VertexFormat::kFloat16x2;
|
||||
return tint::ast::transform::VertexFormat::kFloat16x2;
|
||||
case wgpu::VertexFormat::Float16x4:
|
||||
return tint::transform::VertexFormat::kFloat16x4;
|
||||
return tint::ast::transform::VertexFormat::kFloat16x4;
|
||||
case wgpu::VertexFormat::Float32:
|
||||
return tint::transform::VertexFormat::kFloat32;
|
||||
return tint::ast::transform::VertexFormat::kFloat32;
|
||||
case wgpu::VertexFormat::Float32x2:
|
||||
return tint::transform::VertexFormat::kFloat32x2;
|
||||
return tint::ast::transform::VertexFormat::kFloat32x2;
|
||||
case wgpu::VertexFormat::Float32x3:
|
||||
return tint::transform::VertexFormat::kFloat32x3;
|
||||
return tint::ast::transform::VertexFormat::kFloat32x3;
|
||||
case wgpu::VertexFormat::Float32x4:
|
||||
return tint::transform::VertexFormat::kFloat32x4;
|
||||
return tint::ast::transform::VertexFormat::kFloat32x4;
|
||||
case wgpu::VertexFormat::Uint32:
|
||||
return tint::transform::VertexFormat::kUint32;
|
||||
return tint::ast::transform::VertexFormat::kUint32;
|
||||
case wgpu::VertexFormat::Uint32x2:
|
||||
return tint::transform::VertexFormat::kUint32x2;
|
||||
return tint::ast::transform::VertexFormat::kUint32x2;
|
||||
case wgpu::VertexFormat::Uint32x3:
|
||||
return tint::transform::VertexFormat::kUint32x3;
|
||||
return tint::ast::transform::VertexFormat::kUint32x3;
|
||||
case wgpu::VertexFormat::Uint32x4:
|
||||
return tint::transform::VertexFormat::kUint32x4;
|
||||
return tint::ast::transform::VertexFormat::kUint32x4;
|
||||
case wgpu::VertexFormat::Sint32:
|
||||
return tint::transform::VertexFormat::kSint32;
|
||||
return tint::ast::transform::VertexFormat::kSint32;
|
||||
case wgpu::VertexFormat::Sint32x2:
|
||||
return tint::transform::VertexFormat::kSint32x2;
|
||||
return tint::ast::transform::VertexFormat::kSint32x2;
|
||||
case wgpu::VertexFormat::Sint32x3:
|
||||
return tint::transform::VertexFormat::kSint32x3;
|
||||
return tint::ast::transform::VertexFormat::kSint32x3;
|
||||
case wgpu::VertexFormat::Sint32x4:
|
||||
return tint::transform::VertexFormat::kSint32x4;
|
||||
return tint::ast::transform::VertexFormat::kSint32x4;
|
||||
|
||||
case wgpu::VertexFormat::Undefined:
|
||||
break;
|
||||
|
@ -117,12 +117,12 @@ tint::transform::VertexFormat ToTintVertexFormat(wgpu::VertexFormat format) {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
tint::transform::VertexStepMode ToTintVertexStepMode(wgpu::VertexStepMode mode) {
|
||||
tint::ast::transform::VertexStepMode ToTintVertexStepMode(wgpu::VertexStepMode mode) {
|
||||
switch (mode) {
|
||||
case wgpu::VertexStepMode::Vertex:
|
||||
return tint::transform::VertexStepMode::kVertex;
|
||||
return tint::ast::transform::VertexStepMode::kVertex;
|
||||
case wgpu::VertexStepMode::Instance:
|
||||
return tint::transform::VertexStepMode::kInstance;
|
||||
return tint::ast::transform::VertexStepMode::kInstance;
|
||||
case wgpu::VertexStepMode::VertexBufferNotUsed:
|
||||
break;
|
||||
}
|
||||
|
@ -162,16 +162,16 @@ tint::writer::ExternalTextureOptions BuildExternalTextureTransformBindings(
|
|||
return options;
|
||||
}
|
||||
|
||||
tint::transform::VertexPulling::Config BuildVertexPullingTransformConfig(
|
||||
tint::ast::transform::VertexPulling::Config BuildVertexPullingTransformConfig(
|
||||
const RenderPipelineBase& renderPipeline,
|
||||
BindGroupIndex pullingBufferBindingSet) {
|
||||
tint::transform::VertexPulling::Config cfg;
|
||||
tint::ast::transform::VertexPulling::Config cfg;
|
||||
cfg.pulling_group = static_cast<uint32_t>(pullingBufferBindingSet);
|
||||
|
||||
cfg.vertex_state.resize(renderPipeline.GetVertexBufferCount());
|
||||
for (VertexBufferSlot slot : IterateBitSet(renderPipeline.GetVertexBufferSlotsUsed())) {
|
||||
const VertexBufferInfo& dawnInfo = renderPipeline.GetVertexBuffer(slot);
|
||||
tint::transform::VertexBufferLayoutDescriptor* tintInfo =
|
||||
tint::ast::transform::VertexBufferLayoutDescriptor* tintInfo =
|
||||
&cfg.vertex_state[static_cast<uint8_t>(slot)];
|
||||
|
||||
tintInfo->array_stride = dawnInfo.arrayStride;
|
||||
|
@ -181,7 +181,7 @@ tint::transform::VertexPulling::Config BuildVertexPullingTransformConfig(
|
|||
for (VertexAttributeLocation location :
|
||||
IterateBitSet(renderPipeline.GetAttributeLocationsUsed())) {
|
||||
const VertexAttributeInfo& dawnInfo = renderPipeline.GetAttribute(location);
|
||||
tint::transform::VertexAttributeDescriptor tintInfo;
|
||||
tint::ast::transform::VertexAttributeDescriptor tintInfo;
|
||||
tintInfo.format = ToTintVertexFormat(dawnInfo.format);
|
||||
tintInfo.offset = dawnInfo.offset;
|
||||
tintInfo.shader_location = static_cast<uint32_t>(static_cast<uint8_t>(location));
|
||||
|
@ -192,12 +192,12 @@ tint::transform::VertexPulling::Config BuildVertexPullingTransformConfig(
|
|||
return cfg;
|
||||
}
|
||||
|
||||
tint::transform::SubstituteOverride::Config BuildSubstituteOverridesTransformConfig(
|
||||
tint::ast::transform::SubstituteOverride::Config BuildSubstituteOverridesTransformConfig(
|
||||
const ProgrammableStage& stage) {
|
||||
const EntryPointMetadata& metadata = *stage.metadata;
|
||||
const auto& constants = stage.constants;
|
||||
|
||||
tint::transform::SubstituteOverride::Config cfg;
|
||||
tint::ast::transform::SubstituteOverride::Config cfg;
|
||||
|
||||
for (const auto& [key, value] : constants) {
|
||||
const auto& o = metadata.overrides.at(key);
|
||||
|
|
|
@ -43,11 +43,11 @@ class ScopedTintICEHandler : public NonCopyable {
|
|||
tint::writer::ExternalTextureOptions BuildExternalTextureTransformBindings(
|
||||
const PipelineLayoutBase* layout);
|
||||
|
||||
tint::transform::VertexPulling::Config BuildVertexPullingTransformConfig(
|
||||
tint::ast::transform::VertexPulling::Config BuildVertexPullingTransformConfig(
|
||||
const RenderPipelineBase& renderPipeline,
|
||||
BindGroupIndex pullingBufferBindingSet);
|
||||
|
||||
tint::transform::SubstituteOverride::Config BuildSubstituteOverridesTransformConfig(
|
||||
tint::ast::transform::SubstituteOverride::Config BuildSubstituteOverridesTransformConfig(
|
||||
const ProgrammableStage& stage);
|
||||
|
||||
} // namespace dawn::native
|
||||
|
|
|
@ -42,34 +42,34 @@ namespace dawn::native::d3d {
|
|||
|
||||
enum class Compiler { FXC, DXC };
|
||||
|
||||
#define HLSL_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(std::string_view, entryPointName) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(uint32_t, shaderModel) \
|
||||
X(uint32_t, compileFlags) \
|
||||
X(Compiler, compiler) \
|
||||
X(uint64_t, compilerVersion) \
|
||||
X(std::wstring_view, dxcShaderProfile) \
|
||||
X(std::string_view, fxcShaderProfile) \
|
||||
X(pD3DCompile, d3dCompile) \
|
||||
X(IDxcLibrary*, dxcLibrary) \
|
||||
X(IDxcCompiler*, dxcCompiler) \
|
||||
X(uint32_t, firstIndexOffsetShaderRegister) \
|
||||
X(uint32_t, firstIndexOffsetRegisterSpace) \
|
||||
X(bool, usesNumWorkgroups) \
|
||||
X(uint32_t, numWorkgroupsShaderRegister) \
|
||||
X(uint32_t, numWorkgroupsRegisterSpace) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(tint::writer::ArrayLengthFromUniformOptions, arrayLengthFromUniform) \
|
||||
X(tint::writer::BindingRemapperOptions, bindingRemapper) \
|
||||
X(std::optional<tint::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(std::bitset<kMaxInterStageShaderVariables>, interstageLocations) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(bool, disableSymbolRenaming) \
|
||||
X(bool, isRobustnessEnabled) \
|
||||
X(bool, disableWorkgroupInit) \
|
||||
X(bool, polyfillReflectVec2F32) \
|
||||
#define HLSL_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(std::string_view, entryPointName) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(uint32_t, shaderModel) \
|
||||
X(uint32_t, compileFlags) \
|
||||
X(Compiler, compiler) \
|
||||
X(uint64_t, compilerVersion) \
|
||||
X(std::wstring_view, dxcShaderProfile) \
|
||||
X(std::string_view, fxcShaderProfile) \
|
||||
X(pD3DCompile, d3dCompile) \
|
||||
X(IDxcLibrary*, dxcLibrary) \
|
||||
X(IDxcCompiler*, dxcCompiler) \
|
||||
X(uint32_t, firstIndexOffsetShaderRegister) \
|
||||
X(uint32_t, firstIndexOffsetRegisterSpace) \
|
||||
X(bool, usesNumWorkgroups) \
|
||||
X(uint32_t, numWorkgroupsShaderRegister) \
|
||||
X(uint32_t, numWorkgroupsRegisterSpace) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(tint::writer::ArrayLengthFromUniformOptions, arrayLengthFromUniform) \
|
||||
X(tint::writer::BindingRemapperOptions, bindingRemapper) \
|
||||
X(std::optional<tint::ast::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(std::bitset<kMaxInterStageShaderVariables>, interstageLocations) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(bool, disableSymbolRenaming) \
|
||||
X(bool, isRobustnessEnabled) \
|
||||
X(bool, disableWorkgroupInit) \
|
||||
X(bool, polyfillReflectVec2F32) \
|
||||
X(bool, dumpShaders)
|
||||
|
||||
#define D3D_BYTECODE_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
|
|
|
@ -144,36 +144,36 @@ ResultOrError<std::string> TranslateToHLSL(
|
|||
errorStream << "Tint HLSL failure:" << std::endl;
|
||||
|
||||
tint::transform::Manager transformManager;
|
||||
tint::transform::DataMap transformInputs;
|
||||
tint::ast::transform::DataMap transformInputs;
|
||||
|
||||
// Run before the renamer so that the entry point name matches `entryPointName` still.
|
||||
transformManager.Add<tint::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::transform::SingleEntryPoint::Config>(r.entryPointName.data());
|
||||
transformManager.Add<tint::ast::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::ast::transform::SingleEntryPoint::Config>(r.entryPointName.data());
|
||||
|
||||
// Needs to run before all other transforms so that they can use builtin names safely.
|
||||
transformManager.Add<tint::transform::Renamer>();
|
||||
transformManager.Add<tint::ast::transform::Renamer>();
|
||||
if (r.disableSymbolRenaming) {
|
||||
// We still need to rename HLSL reserved keywords
|
||||
transformInputs.Add<tint::transform::Renamer::Config>(
|
||||
tint::transform::Renamer::Target::kHlslKeywords);
|
||||
transformInputs.Add<tint::ast::transform::Renamer::Config>(
|
||||
tint::ast::transform::Renamer::Target::kHlslKeywords);
|
||||
}
|
||||
|
||||
if (r.stage == SingleShaderStage::Vertex) {
|
||||
transformManager.Add<tint::transform::FirstIndexOffset>();
|
||||
transformInputs.Add<tint::transform::FirstIndexOffset::BindingPoint>(
|
||||
transformManager.Add<tint::ast::transform::FirstIndexOffset>();
|
||||
transformInputs.Add<tint::ast::transform::FirstIndexOffset::BindingPoint>(
|
||||
r.firstIndexOffsetShaderRegister, r.firstIndexOffsetRegisterSpace);
|
||||
}
|
||||
|
||||
if (r.substituteOverrideConfig) {
|
||||
// This needs to run after SingleEntryPoint transform which removes unused overrides for
|
||||
// current entry point.
|
||||
transformManager.Add<tint::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::transform::SubstituteOverride::Config>(
|
||||
transformManager.Add<tint::ast::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::ast::transform::SubstituteOverride::Config>(
|
||||
std::move(r.substituteOverrideConfig).value());
|
||||
}
|
||||
|
||||
tint::Program transformedProgram;
|
||||
tint::transform::DataMap transformOutputs;
|
||||
tint::ast::transform::DataMap transformOutputs;
|
||||
{
|
||||
TRACE_EVENT0(tracePlatform.UnsafeGetValue(), General, "RunTransforms");
|
||||
DAWN_TRY_ASSIGN(transformedProgram,
|
||||
|
@ -181,7 +181,7 @@ ResultOrError<std::string> TranslateToHLSL(
|
|||
&transformOutputs, nullptr));
|
||||
}
|
||||
|
||||
if (auto* data = transformOutputs.Get<tint::transform::Renamer::Data>()) {
|
||||
if (auto* data = transformOutputs.Get<tint::ast::transform::Renamer::Data>()) {
|
||||
auto it = data->remappings.find(r.entryPointName.data());
|
||||
if (it != data->remappings.end()) {
|
||||
*remappedEntryPointName = it->second;
|
||||
|
@ -203,7 +203,7 @@ ResultOrError<std::string> TranslateToHLSL(
|
|||
}
|
||||
|
||||
if (r.stage == SingleShaderStage::Vertex) {
|
||||
if (auto* data = transformOutputs.Get<tint::transform::FirstIndexOffset::Data>()) {
|
||||
if (auto* data = transformOutputs.Get<tint::ast::transform::FirstIndexOffset::Data>()) {
|
||||
*usesVertexOrInstanceIndex = data->has_vertex_or_instance_index;
|
||||
} else {
|
||||
return DAWN_VALIDATION_ERROR("Transform output missing first index offset data.");
|
||||
|
|
|
@ -127,7 +127,7 @@ ResultOrError<d3d::CompiledShader> ShaderModule::Compile(
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<tint::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
std::optional<tint::ast::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
if (!programmableStage.metadata->overrides.empty()) {
|
||||
substituteOverrideConfig = BuildSubstituteOverridesTransformConfig(programmableStage);
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ ResultOrError<d3d::CompiledShader> ShaderModule::Compile(
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<tint::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
std::optional<tint::ast::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
if (!programmableStage.metadata->overrides.empty()) {
|
||||
substituteOverrideConfig = BuildSubstituteOverridesTransformConfig(programmableStage);
|
||||
}
|
||||
|
|
|
@ -34,23 +34,24 @@
|
|||
namespace dawn::native::metal {
|
||||
namespace {
|
||||
|
||||
using OptionalVertexPullingTransformConfig = std::optional<tint::transform::VertexPulling::Config>;
|
||||
using OptionalVertexPullingTransformConfig =
|
||||
std::optional<tint::ast::transform::VertexPulling::Config>;
|
||||
|
||||
#define MSL_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(tint::writer::ArrayLengthFromUniformOptions, arrayLengthFromUniform) \
|
||||
X(tint::writer::BindingRemapperOptions, bindingRemapper) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(OptionalVertexPullingTransformConfig, vertexPullingTransformConfig) \
|
||||
X(std::optional<tint::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(std::string, entryPointName) \
|
||||
X(uint32_t, sampleMask) \
|
||||
X(bool, emitVertexPointSize) \
|
||||
X(bool, isRobustnessEnabled) \
|
||||
X(bool, disableSymbolRenaming) \
|
||||
X(bool, disableWorkgroupInit) \
|
||||
#define MSL_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(tint::writer::ArrayLengthFromUniformOptions, arrayLengthFromUniform) \
|
||||
X(tint::writer::BindingRemapperOptions, bindingRemapper) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(OptionalVertexPullingTransformConfig, vertexPullingTransformConfig) \
|
||||
X(std::optional<tint::ast::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(std::string, entryPointName) \
|
||||
X(uint32_t, sampleMask) \
|
||||
X(bool, emitVertexPointSize) \
|
||||
X(bool, isRobustnessEnabled) \
|
||||
X(bool, disableSymbolRenaming) \
|
||||
X(bool, disableWorkgroupInit) \
|
||||
X(CacheKey::UnsafeUnkeyedValue<dawn::platform::Platform*>, tracePlatform)
|
||||
|
||||
DAWN_MAKE_CACHE_REQUEST(MslCompilationRequest, MSL_COMPILATION_REQUEST_MEMBERS);
|
||||
|
@ -152,7 +153,7 @@ ResultOrError<CacheResult<MslCompilation>> TranslateToMSL(
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<tint::transform::VertexPulling::Config> vertexPullingTransformConfig;
|
||||
std::optional<tint::ast::transform::VertexPulling::Config> vertexPullingTransformConfig;
|
||||
if (stage == SingleShaderStage::Vertex &&
|
||||
device->IsToggleEnabled(Toggle::MetalEnableVertexPulling)) {
|
||||
vertexPullingTransformConfig =
|
||||
|
@ -176,7 +177,7 @@ ResultOrError<CacheResult<MslCompilation>> TranslateToMSL(
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<tint::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
std::optional<tint::ast::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
if (!programmableStage.metadata->overrides.empty()) {
|
||||
substituteOverrideConfig = BuildSubstituteOverridesTransformConfig(programmableStage);
|
||||
}
|
||||
|
@ -206,38 +207,38 @@ ResultOrError<CacheResult<MslCompilation>> TranslateToMSL(
|
|||
mslCompilation, device, std::move(req), MslCompilation::FromBlob,
|
||||
[](MslCompilationRequest r) -> ResultOrError<MslCompilation> {
|
||||
tint::transform::Manager transformManager;
|
||||
tint::transform::DataMap transformInputs;
|
||||
tint::ast::transform::DataMap transformInputs;
|
||||
|
||||
// We only remap bindings for the target entry point, so we need to strip all other
|
||||
// entry points to avoid generating invalid bindings for them.
|
||||
// Run before the renamer so that the entry point name matches `entryPointName` still.
|
||||
transformManager.Add<tint::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::transform::SingleEntryPoint::Config>(r.entryPointName);
|
||||
transformManager.Add<tint::ast::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::ast::transform::SingleEntryPoint::Config>(r.entryPointName);
|
||||
|
||||
// Needs to run before all other transforms so that they can use builtin names safely.
|
||||
transformManager.Add<tint::transform::Renamer>();
|
||||
transformManager.Add<tint::ast::transform::Renamer>();
|
||||
if (r.disableSymbolRenaming) {
|
||||
// We still need to rename MSL reserved keywords
|
||||
transformInputs.Add<tint::transform::Renamer::Config>(
|
||||
tint::transform::Renamer::Target::kMslKeywords);
|
||||
transformInputs.Add<tint::ast::transform::Renamer::Config>(
|
||||
tint::ast::transform::Renamer::Target::kMslKeywords);
|
||||
}
|
||||
|
||||
if (r.vertexPullingTransformConfig) {
|
||||
transformManager.Add<tint::transform::VertexPulling>();
|
||||
transformInputs.Add<tint::transform::VertexPulling::Config>(
|
||||
transformManager.Add<tint::ast::transform::VertexPulling>();
|
||||
transformInputs.Add<tint::ast::transform::VertexPulling::Config>(
|
||||
std::move(r.vertexPullingTransformConfig).value());
|
||||
}
|
||||
|
||||
if (r.substituteOverrideConfig) {
|
||||
// This needs to run after SingleEntryPoint transform which removes unused overrides
|
||||
// for current entry point.
|
||||
transformManager.Add<tint::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::transform::SubstituteOverride::Config>(
|
||||
transformManager.Add<tint::ast::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::ast::transform::SubstituteOverride::Config>(
|
||||
std::move(r.substituteOverrideConfig).value());
|
||||
}
|
||||
|
||||
tint::Program program;
|
||||
tint::transform::DataMap transformOutputs;
|
||||
tint::ast::transform::DataMap transformOutputs;
|
||||
{
|
||||
TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "RunTransforms");
|
||||
DAWN_TRY_ASSIGN(program,
|
||||
|
@ -246,7 +247,7 @@ ResultOrError<CacheResult<MslCompilation>> TranslateToMSL(
|
|||
}
|
||||
|
||||
std::string remappedEntryPointName;
|
||||
if (auto* data = transformOutputs.Get<tint::transform::Renamer::Data>()) {
|
||||
if (auto* data = transformOutputs.Get<tint::ast::transform::Renamer::Data>()) {
|
||||
auto it = data->remappings.find(r.entryPointName);
|
||||
if (it != data->remappings.end()) {
|
||||
remappedEntryPointName = it->second;
|
||||
|
|
|
@ -391,17 +391,17 @@ MaybeError ComputePipeline::Initialize() {
|
|||
tint::Program transformedProgram;
|
||||
const tint::Program* program;
|
||||
tint::transform::Manager transformManager;
|
||||
tint::transform::DataMap transformInputs;
|
||||
tint::ast::transform::DataMap transformInputs;
|
||||
|
||||
if (!computeStage.metadata->overrides.empty()) {
|
||||
transformManager.Add<tint::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::transform::SingleEntryPoint::Config>(
|
||||
transformManager.Add<tint::ast::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::ast::transform::SingleEntryPoint::Config>(
|
||||
computeStage.entryPoint.c_str());
|
||||
|
||||
// This needs to run after SingleEntryPoint transform which removes unused overrides for
|
||||
// current entry point.
|
||||
transformManager.Add<tint::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::transform::SubstituteOverride::Config>(
|
||||
transformManager.Add<tint::ast::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::ast::transform::SubstituteOverride::Config>(
|
||||
BuildSubstituteOverridesTransformConfig(computeStage));
|
||||
}
|
||||
|
||||
|
|
|
@ -57,16 +57,16 @@ tint::writer::glsl::Version::Standard ToTintGLStandard(opengl::OpenGLVersion::St
|
|||
|
||||
using BindingMap = std::unordered_map<tint::writer::BindingPoint, tint::writer::BindingPoint>;
|
||||
|
||||
#define GLSL_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(std::string, entryPointName) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(BindingMap, glBindings) \
|
||||
X(std::optional<tint::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(opengl::OpenGLVersion::Standard, glVersionStandard) \
|
||||
X(uint32_t, glVersionMajor) \
|
||||
#define GLSL_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(std::string, entryPointName) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(BindingMap, glBindings) \
|
||||
X(std::optional<tint::ast::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(opengl::OpenGLVersion::Standard, glVersionStandard) \
|
||||
X(uint32_t, glVersionMajor) \
|
||||
X(uint32_t, glVersionMinor)
|
||||
|
||||
DAWN_MAKE_CACHE_REQUEST(GLSLCompilationRequest, GLSL_COMPILATION_REQUEST_MEMBERS);
|
||||
|
@ -171,7 +171,7 @@ ResultOrError<GLuint> ShaderModule::CompileShader(const OpenGLFunctions& gl,
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<tint::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
std::optional<tint::ast::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
if (!programmableStage.metadata->overrides.empty()) {
|
||||
substituteOverrideConfig = BuildSubstituteOverridesTransformConfig(programmableStage);
|
||||
}
|
||||
|
@ -195,15 +195,16 @@ ResultOrError<GLuint> ShaderModule::CompileShader(const OpenGLFunctions& gl,
|
|||
compilationResult, GetDevice(), std::move(req), GLSLCompilation::FromBlob,
|
||||
[](GLSLCompilationRequest r) -> ResultOrError<GLSLCompilation> {
|
||||
tint::transform::Manager transformManager;
|
||||
tint::transform::DataMap transformInputs;
|
||||
tint::ast::transform::DataMap transformInputs;
|
||||
|
||||
if (r.substituteOverrideConfig) {
|
||||
transformManager.Add<tint::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::transform::SingleEntryPoint::Config>(r.entryPointName);
|
||||
transformManager.Add<tint::ast::transform::SingleEntryPoint>();
|
||||
transformInputs.Add<tint::ast::transform::SingleEntryPoint::Config>(
|
||||
r.entryPointName);
|
||||
// This needs to run after SingleEntryPoint transform which removes unused overrides
|
||||
// for current entry point.
|
||||
transformManager.Add<tint::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::transform::SubstituteOverride::Config>(
|
||||
transformManager.Add<tint::ast::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::ast::transform::SubstituteOverride::Config>(
|
||||
std::move(r.substituteOverrideConfig).value());
|
||||
}
|
||||
|
||||
|
|
|
@ -163,19 +163,19 @@ void ShaderModule::DestroyImpl() {
|
|||
|
||||
ShaderModule::~ShaderModule() = default;
|
||||
|
||||
#define SPIRV_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(tint::writer::BindingRemapperOptions, bindingRemapper) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(std::optional<tint::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(std::string_view, entryPointName) \
|
||||
X(bool, isRobustnessEnabled) \
|
||||
X(bool, disableWorkgroupInit) \
|
||||
X(bool, disableSymbolRenaming) \
|
||||
X(bool, useZeroInitializeWorkgroupMemoryExtension) \
|
||||
X(bool, clampFragDepth) \
|
||||
#define SPIRV_COMPILATION_REQUEST_MEMBERS(X) \
|
||||
X(SingleShaderStage, stage) \
|
||||
X(const tint::Program*, inputProgram) \
|
||||
X(tint::writer::BindingRemapperOptions, bindingRemapper) \
|
||||
X(tint::writer::ExternalTextureOptions, externalTextureOptions) \
|
||||
X(std::optional<tint::ast::transform::SubstituteOverride::Config>, substituteOverrideConfig) \
|
||||
X(LimitsForCompilationRequest, limits) \
|
||||
X(std::string_view, entryPointName) \
|
||||
X(bool, isRobustnessEnabled) \
|
||||
X(bool, disableWorkgroupInit) \
|
||||
X(bool, disableSymbolRenaming) \
|
||||
X(bool, useZeroInitializeWorkgroupMemoryExtension) \
|
||||
X(bool, clampFragDepth) \
|
||||
X(CacheKey::UnsafeUnkeyedValue<dawn::platform::Platform*>, tracePlatform)
|
||||
|
||||
DAWN_MAKE_CACHE_REQUEST(SpirvCompilationRequest, SPIRV_COMPILATION_REQUEST_MEMBERS);
|
||||
|
@ -244,7 +244,7 @@ ResultOrError<ShaderModule::ModuleAndSpirv> ShaderModule::GetHandleAndSpirv(
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<tint::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
std::optional<tint::ast::transform::SubstituteOverride::Config> substituteOverrideConfig;
|
||||
if (!programmableStage.metadata->overrides.empty()) {
|
||||
substituteOverrideConfig = BuildSubstituteOverridesTransformConfig(programmableStage);
|
||||
}
|
||||
|
@ -273,29 +273,29 @@ ResultOrError<ShaderModule::ModuleAndSpirv> ShaderModule::GetHandleAndSpirv(
|
|||
compilation, GetDevice(), std::move(req), CompiledSpirv::FromBlob,
|
||||
[](SpirvCompilationRequest r) -> ResultOrError<CompiledSpirv> {
|
||||
tint::transform::Manager transformManager;
|
||||
tint::transform::DataMap transformInputs;
|
||||
tint::ast::transform::DataMap transformInputs;
|
||||
|
||||
// Many Vulkan drivers can't handle multi-entrypoint shader modules.
|
||||
// Run before the renamer so that the entry point name matches `entryPointName` still.
|
||||
transformManager.append(std::make_unique<tint::transform::SingleEntryPoint>());
|
||||
transformInputs.Add<tint::transform::SingleEntryPoint::Config>(
|
||||
transformManager.append(std::make_unique<tint::ast::transform::SingleEntryPoint>());
|
||||
transformInputs.Add<tint::ast::transform::SingleEntryPoint::Config>(
|
||||
std::string(r.entryPointName));
|
||||
|
||||
// Needs to run before all other transforms so that they can use builtin names safely.
|
||||
if (!r.disableSymbolRenaming) {
|
||||
transformManager.Add<tint::transform::Renamer>();
|
||||
transformManager.Add<tint::ast::transform::Renamer>();
|
||||
}
|
||||
|
||||
if (r.substituteOverrideConfig) {
|
||||
// This needs to run after SingleEntryPoint transform which removes unused overrides
|
||||
// for current entry point.
|
||||
transformManager.Add<tint::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::transform::SubstituteOverride::Config>(
|
||||
transformManager.Add<tint::ast::transform::SubstituteOverride>();
|
||||
transformInputs.Add<tint::ast::transform::SubstituteOverride::Config>(
|
||||
std::move(r.substituteOverrideConfig).value());
|
||||
}
|
||||
|
||||
tint::Program program;
|
||||
tint::transform::DataMap transformOutputs;
|
||||
tint::ast::transform::DataMap transformOutputs;
|
||||
{
|
||||
TRACE_EVENT0(r.tracePlatform.UnsafeGetValue(), General, "RunTransforms");
|
||||
DAWN_TRY_ASSIGN(program,
|
||||
|
@ -308,7 +308,7 @@ ResultOrError<ShaderModule::ModuleAndSpirv> ShaderModule::GetHandleAndSpirv(
|
|||
if (r.disableSymbolRenaming) {
|
||||
remappedEntryPoint = r.entryPointName;
|
||||
} else {
|
||||
auto* data = transformOutputs.Get<tint::transform::Renamer::Data>();
|
||||
auto* data = transformOutputs.Get<tint::ast::transform::Renamer::Data>();
|
||||
ASSERT(data != nullptr);
|
||||
|
||||
auto it = data->remappings.find(r.entryPointName.data());
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#include "src/tint/utils/hashmap.h"
|
||||
#include "src/tint/utils/hashset.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::AddBlockAttribute);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::AddBlockAttribute::BlockAttribute);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::AddBlockAttribute);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::AddBlockAttribute::BlockAttribute);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
AddBlockAttribute::AddBlockAttribute() = default;
|
||||
|
||||
|
@ -114,4 +114,4 @@ const AddBlockAttribute::BlockAttribute* AddBlockAttribute::BlockAttribute::Clon
|
|||
ctx->dst->ID(), ctx->dst->AllocateNodeID());
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "src/tint/ast/internal_attribute.h"
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// AddBlockAttribute is a transform that wrap the store type of a buffer into a struct if possible,
|
||||
/// then adds an `@internal(block)` attribute to the wrapper struct.
|
||||
|
@ -59,6 +59,6 @@ class AddBlockAttribute final : public utils::Castable<AddBlockAttribute, Transf
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_ADD_BLOCK_ATTRIBUTE_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using AddBlockAttributeTest = TransformTest;
|
||||
|
@ -1022,4 +1022,4 @@ fn main() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
#include "src/tint/program_builder.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::AddEmptyEntryPoint);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::AddEmptyEntryPoint);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
bool ShouldRun(const Program* program) {
|
||||
|
@ -60,4 +60,4 @@ Transform::ApplyResult AddEmptyEntryPoint::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Add an empty entry point to the module, if no other entry points exist.
|
||||
class AddEmptyEntryPoint final : public utils::Castable<AddEmptyEntryPoint, Transform> {
|
||||
|
@ -33,6 +33,6 @@ class AddEmptyEntryPoint final : public utils::Castable<AddEmptyEntryPoint, Tran
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_ADD_EMPTY_ENTRY_POINT_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using AddEmptyEntryPointTest = TransformTest;
|
||||
|
@ -83,4 +83,4 @@ var<private> unused_entry_point : f32;
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "src/tint/sem/statement.h"
|
||||
#include "src/tint/sem/variable.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ArrayLengthFromUniform);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ArrayLengthFromUniform::Config);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ArrayLengthFromUniform::Result);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ArrayLengthFromUniform);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ArrayLengthFromUniform::Config);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ArrayLengthFromUniform::Result);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -268,4 +268,4 @@ ArrayLengthFromUniform::Result::Result(std::unordered_set<uint32_t> used_size_in
|
|||
ArrayLengthFromUniform::Result::Result(const Result&) = default;
|
||||
ArrayLengthFromUniform::Result::~Result() = default;
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace tint {
|
|||
class CloneContext;
|
||||
} // namespace tint
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// ArrayLengthFromUniform is a transform that implements calls to arrayLength()
|
||||
/// by calculating the length from the total size of the storage buffer, which
|
||||
|
@ -60,7 +60,7 @@ class ArrayLengthFromUniform final : public utils::Castable<ArrayLengthFromUnifo
|
|||
~ArrayLengthFromUniform() override;
|
||||
|
||||
/// Configuration options for the ArrayLengthFromUniform transform.
|
||||
struct Config final : public utils::Castable<Data, transform::Data> {
|
||||
struct Config final : public utils::Castable<Config, Data> {
|
||||
/// Constructor
|
||||
/// @param ubo_bp the binding point to use for the generated uniform buffer.
|
||||
explicit Config(sem::BindingPoint ubo_bp);
|
||||
|
@ -85,7 +85,7 @@ class ArrayLengthFromUniform final : public utils::Castable<ArrayLengthFromUnifo
|
|||
/// Information produced about what the transform did.
|
||||
/// If there were no calls to the arrayLength() builtin, then no Result will
|
||||
/// be emitted.
|
||||
struct Result final : public utils::Castable<Result, transform::Data> {
|
||||
struct Result final : public utils::Castable<Result, Data> {
|
||||
/// Constructor
|
||||
/// @param used_size_indices Indices into the UBO that are statically used.
|
||||
explicit Result(std::unordered_set<uint32_t> used_size_indices);
|
||||
|
@ -109,6 +109,6 @@ class ArrayLengthFromUniform final : public utils::Castable<ArrayLengthFromUnifo
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_ARRAY_LENGTH_FROM_UNIFORM_H_
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "src/tint/ast/transform/test_helper.h"
|
||||
#include "src/tint/ast/transform/unshadow.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using ArrayLengthFromUniformTest = TransformTest;
|
||||
|
@ -99,9 +99,7 @@ fn main() {
|
|||
}
|
||||
)";
|
||||
|
||||
auto* expect =
|
||||
"error: missing transform data for "
|
||||
"tint::transform::ArrayLengthFromUniform";
|
||||
auto* expect = "error: missing transform data for tint::ast::transform::ArrayLengthFromUniform";
|
||||
|
||||
auto got = Run<Unshadow, SimplifyPointers, ArrayLengthFromUniform>(src);
|
||||
|
||||
|
@ -515,4 +513,4 @@ struct SB {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "src/tint/sem/variable.h"
|
||||
#include "src/tint/utils/string.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BindingRemapper::Remappings);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::BindingRemapper);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::BindingRemapper::Remappings);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
BindingRemapper::Remappings::Remappings(BindingPoints bp, AccessControls ac, bool may_collide)
|
||||
: binding_points(std::move(bp)),
|
||||
|
@ -161,4 +161,4 @@ Transform::ApplyResult BindingRemapper::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "src/tint/builtin/access.h"
|
||||
#include "src/tint/sem/binding_point.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// BindingPoint is an alias to sem::BindingPoint
|
||||
using BindingPoint = sem::BindingPoint;
|
||||
|
@ -38,7 +38,7 @@ class BindingRemapper final : public utils::Castable<BindingRemapper, Transform>
|
|||
|
||||
/// Remappings is consumed by the BindingRemapper transform.
|
||||
/// Data holds information about shader usage and constant buffer offsets.
|
||||
struct Remappings final : public utils::Castable<Data, transform::Data> {
|
||||
struct Remappings final : public utils::Castable<Remappings, Data> {
|
||||
/// Constructor
|
||||
/// @param bp a map of new binding points
|
||||
/// @param ac a map of new access controls
|
||||
|
@ -73,6 +73,6 @@ class BindingRemapper final : public utils::Castable<BindingRemapper, Transform>
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_BINDING_REMAPPER_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using BindingRemapperTest = TransformTest;
|
||||
|
@ -344,7 +344,7 @@ fn f() {
|
|||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(error: missing transform data for tint::transform::BindingRemapper)";
|
||||
auto* expect = R"(error: missing transform data for tint::ast::transform::BindingRemapper)";
|
||||
|
||||
auto got = Run<BindingRemapper>(src);
|
||||
|
||||
|
@ -352,4 +352,4 @@ fn f() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BuiltinPolyfill);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::BuiltinPolyfill::Config);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::BuiltinPolyfill);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::BuiltinPolyfill::Config);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// BinaryOpSignature is tuple of a binary op, LHS type and RHS type
|
||||
using BinaryOpSignature = std::tuple<ast::BinaryOp, const type::Type*, const type::Type*>;
|
||||
|
@ -1288,4 +1288,4 @@ BuiltinPolyfill::Config::Config(const Builtins& b) : builtins(b) {}
|
|||
BuiltinPolyfill::Config::Config(const Config&) = default;
|
||||
BuiltinPolyfill::Config::~Config() = default;
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Implements builtins for backends that do not have a native implementation.
|
||||
class BuiltinPolyfill final : public utils::Castable<BuiltinPolyfill, Transform> {
|
||||
|
@ -89,7 +89,7 @@ class BuiltinPolyfill final : public utils::Castable<BuiltinPolyfill, Transform>
|
|||
|
||||
/// Config is consumed by the BuiltinPolyfill transform.
|
||||
/// Config specifies the builtins that should be polyfilled.
|
||||
struct Config final : public utils::Castable<Data, transform::Data> {
|
||||
struct Config final : public utils::Castable<Config, Data> {
|
||||
/// Constructor
|
||||
/// @param b the list of builtins to polyfill
|
||||
explicit Config(const Builtins& b);
|
||||
|
@ -113,6 +113,6 @@ class BuiltinPolyfill final : public utils::Castable<BuiltinPolyfill, Transform>
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_BUILTIN_POLYFILL_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "src/tint/ast/transform/direct_variable_access.h"
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using Level = BuiltinPolyfill::Level;
|
||||
|
@ -4030,4 +4030,4 @@ fn f(x : i32, y : u32, z : u32) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
#include "src/tint/utils/hash.h"
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::CalculateArrayLength);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::CalculateArrayLength::BufferSizeIntrinsic);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::CalculateArrayLength);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::CalculateArrayLength::BufferSizeIntrinsic);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -245,4 +245,4 @@ Transform::ApplyResult CalculateArrayLength::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace tint {
|
|||
class CloneContext;
|
||||
} // namespace tint
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// CalculateArrayLength is a transform used to replace calls to arrayLength()
|
||||
/// with a value calculated from the size of the storage buffer.
|
||||
|
@ -66,6 +66,6 @@ class CalculateArrayLength final : public utils::Castable<CalculateArrayLength,
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_CALCULATE_ARRAY_LENGTH_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "src/tint/ast/transform/test_helper.h"
|
||||
#include "src/tint/ast/transform/unshadow.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using CalculateArrayLengthTest = TransformTest;
|
||||
|
@ -548,4 +548,4 @@ struct SB2 {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::CanonicalizeEntryPointIO);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::CanonicalizeEntryPointIO::Config);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::CanonicalizeEntryPointIO);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::CanonicalizeEntryPointIO::Config);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
CanonicalizeEntryPointIO::CanonicalizeEntryPointIO() = default;
|
||||
CanonicalizeEntryPointIO::~CanonicalizeEntryPointIO() = default;
|
||||
|
@ -873,4 +873,4 @@ CanonicalizeEntryPointIO::Config::Config(ShaderStyle style,
|
|||
CanonicalizeEntryPointIO::Config::Config(const Config&) = default;
|
||||
CanonicalizeEntryPointIO::Config::~Config() = default;
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// CanonicalizeEntryPointIO is a transform used to rewrite shader entry point
|
||||
/// interfaces into a form that the generators can handle. Each entry point
|
||||
|
@ -136,6 +136,6 @@ class CanonicalizeEntryPointIO final : public utils::Castable<CanonicalizeEntryP
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_CANONICALIZE_ENTRY_POINT_IO_H_
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "src/tint/ast/transform/test_helper.h"
|
||||
#include "src/tint/ast/transform/unshadow.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using CanonicalizeEntryPointIOTest = TransformTest;
|
||||
|
@ -26,8 +26,7 @@ TEST_F(CanonicalizeEntryPointIOTest, Error_MissingTransformData) {
|
|||
auto* src = "";
|
||||
|
||||
auto* expect =
|
||||
"error: missing transform data for "
|
||||
"tint::transform::CanonicalizeEntryPointIO";
|
||||
"error: missing transform data for tint::ast::transform::CanonicalizeEntryPointIO";
|
||||
|
||||
auto got = Run<Unshadow, CanonicalizeEntryPointIO>(src);
|
||||
|
||||
|
@ -3965,4 +3964,4 @@ fn main() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
#include "src/tint/utils/scoped_assignment.h"
|
||||
#include "src/tint/utils/vector.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ClampFragDepth);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ClampFragDepth);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// PIMPL state for the transform
|
||||
struct ClampFragDepth::State {
|
||||
|
@ -225,4 +225,4 @@ Transform::ApplyResult ClampFragDepth::Apply(const Program* src, const DataMap&,
|
|||
return State{src}.Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace tint {
|
|||
class CloneContext;
|
||||
} // namespace tint
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Add clamping of the `@builtin(frag_depth)` output of fragment shaders using two push constants
|
||||
/// provided by the outside environment. For example the following code:
|
||||
|
@ -70,6 +70,6 @@ class ClampFragDepth final : public utils::Castable<ClampFragDepth, Transform> {
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_CLAMP_FRAG_DEPTH_H_
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using ClampFragDepthTest = TransformTest;
|
||||
|
@ -378,4 +378,4 @@ fn main() -> S {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::CombineSamplers);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::CombineSamplers::BindingInfo);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::CombineSamplers);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::CombineSamplers::BindingInfo);
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -37,7 +37,7 @@ bool IsGlobal(const tint::sem::VariablePair& pair) {
|
|||
|
||||
} // namespace
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
|
@ -353,4 +353,4 @@ Transform::ApplyResult CombineSamplers::Apply(const Program* src,
|
|||
return State(src, binding_info).Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "src/tint/ast/transform/transform.h"
|
||||
#include "src/tint/sem/sampler_texture_pair.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// This transform converts all separate texture/sampler refences in a
|
||||
/// program into combined texture/samplers. This is required for GLSL,
|
||||
|
@ -62,7 +62,7 @@ class CombineSamplers final : public utils::Castable<CombineSamplers, Transform>
|
|||
|
||||
/// The client-provided mapping from separate texture and sampler binding
|
||||
/// points to combined sampler binding point.
|
||||
struct BindingInfo final : public utils::Castable<Data, transform::Data> {
|
||||
struct BindingInfo final : public utils::Castable<BindingInfo, Data> {
|
||||
/// Constructor
|
||||
/// @param map the map of all (texture, sampler) -> (combined) pairs
|
||||
/// @param placeholder the binding point to use for placeholder samplers.
|
||||
|
@ -97,6 +97,6 @@ class CombineSamplers final : public utils::Castable<CombineSamplers, Transform>
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_COMBINE_SAMPLERS_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using CombineSamplersTest = TransformTest;
|
||||
|
@ -985,4 +985,4 @@ fn main() -> vec4<f32> {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeMemoryAccess::Intrinsic);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DecomposeMemoryAccess);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DecomposeMemoryAccess::Intrinsic);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ Transform::ApplyResult DecomposeMemoryAccess::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::Offset);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::OffsetLiteral);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::Offset);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::OffsetLiteral);
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace tint {
|
|||
class CloneContext;
|
||||
} // namespace tint
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// DecomposeMemoryAccess is a transform used to replace storage and uniform buffer accesses with a
|
||||
/// combination of load, store or atomic functions on primitive types.
|
||||
|
@ -129,6 +129,6 @@ class DecomposeMemoryAccess final : public utils::Castable<DecomposeMemoryAccess
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_DECOMPOSE_MEMORY_ACCESS_H_
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using DecomposeMemoryAccessTest = TransformTest;
|
||||
|
@ -3962,4 +3962,4 @@ struct S {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#include "src/tint/utils/hash.h"
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeStridedArray);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DecomposeStridedArray);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using DecomposedArrays = std::unordered_map<const type::Array*, Symbol>;
|
||||
|
@ -175,4 +175,4 @@ Transform::ApplyResult DecomposeStridedArray::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// DecomposeStridedArray transforms replaces arrays with a non-default
|
||||
/// `@stride` attribute with an array of structure elements, where the
|
||||
|
@ -41,6 +41,6 @@ class DecomposeStridedArray final : public utils::Castable<DecomposeStridedArray
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_DECOMPOSE_STRIDED_ARRAY_H_
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using DecomposeStridedArrayTest = TransformTest;
|
||||
|
@ -738,4 +738,4 @@ fn f() {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "src/tint/utils/hash.h"
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DecomposeStridedMatrix);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DecomposeStridedMatrix);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
/// MatrixInfo describes a matrix member with a custom stride
|
||||
|
@ -205,4 +205,4 @@ Transform::ApplyResult DecomposeStridedMatrix::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// DecomposeStridedMatrix transforms replaces matrix members of storage or
|
||||
/// uniform buffer structures, that have a stride attribute, into an array
|
||||
|
@ -41,6 +41,6 @@ class DecomposeStridedMatrix final : public utils::Castable<DecomposeStridedMatr
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_DECOMPOSE_STRIDED_MATRIX_H_
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using DecomposeStridedMatrixTest = TransformTest;
|
||||
|
@ -633,4 +633,4 @@ fn f() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#include "src/tint/type/reference.h"
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DemoteToHelper);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DemoteToHelper);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
DemoteToHelper::DemoteToHelper() = default;
|
||||
|
||||
|
@ -246,4 +246,4 @@ Transform::ApplyResult DemoteToHelper::Apply(const Program* src, const DataMap&,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Implement demote-to-helper semantics for discard statements.
|
||||
///
|
||||
|
@ -42,6 +42,6 @@ class DemoteToHelper final : public utils::Castable<DemoteToHelper, Transform> {
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_DEMOTE_TO_HELPER_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using DemoteToHelperTest = TransformTest;
|
||||
|
@ -1202,4 +1202,4 @@ fn foo(@location(0) in : f32) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
#include "src/tint/utils/scoped_assignment.h"
|
||||
#include "src/tint/utils/string_stream.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DirectVariableAccess);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DirectVariableAccess::Config);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DirectVariableAccess);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DirectVariableAccess::Config);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
|
@ -190,7 +190,7 @@ struct Hasher<AccessShape> {
|
|||
|
||||
} // namespace tint::utils
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// The PIMPL state for the DirectVariableAccess transform
|
||||
struct DirectVariableAccess::State {
|
||||
|
@ -1217,4 +1217,4 @@ Transform::ApplyResult DirectVariableAccess::Apply(const Program* program,
|
|||
return State(program, options).Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// DirectVariableAccess is a transform that allows usage of pointer parameters in the 'storage',
|
||||
/// 'uniform' and 'workgroup' address space, and passing of pointers to sub-objects. These pointers
|
||||
|
@ -49,7 +49,7 @@ class DirectVariableAccess final : public utils::Castable<DirectVariableAccess,
|
|||
|
||||
/// Config is consumed by the DirectVariableAccess transform.
|
||||
/// Config specifies the behavior of the transform.
|
||||
struct Config final : public utils::Castable<Data, transform::Data> {
|
||||
struct Config final : public utils::Castable<Config, Data> {
|
||||
/// Constructor
|
||||
/// @param options behavior of the transform
|
||||
explicit Config(const Options& options);
|
||||
|
@ -69,6 +69,6 @@ class DirectVariableAccess final : public utils::Castable<DirectVariableAccess,
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_DIRECT_VARIABLE_ACCESS_H_
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "src/tint/ast/transform/test_helper.h"
|
||||
#include "src/tint/utils/string.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
/// @returns a DataMap with DirectVariableAccess::Config::transform_private enabled.
|
||||
|
@ -2710,4 +2710,4 @@ fn c() {
|
|||
} // namespace complex_tests
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#include "src/tint/program_builder.h"
|
||||
#include "src/tint/sem/module.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::DisableUniformityAnalysis);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::DisableUniformityAnalysis);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
DisableUniformityAnalysis::DisableUniformityAnalysis() = default;
|
||||
|
||||
|
@ -43,4 +43,4 @@ Transform::ApplyResult DisableUniformityAnalysis::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Disable uniformity analysis for the program.
|
||||
class DisableUniformityAnalysis final
|
||||
|
@ -34,6 +34,6 @@ class DisableUniformityAnalysis final
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_DISABLE_UNIFORMITY_ANALYSIS_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using DisableUniformityAnalysisTest = TransformTest;
|
||||
|
@ -70,4 +70,4 @@ fn main() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "src/tint/sem/statement.h"
|
||||
#include "src/tint/sem/value_expression.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ExpandCompoundAssignment);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ExpandCompoundAssignment);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -187,4 +187,4 @@ Transform::ApplyResult ExpandCompoundAssignment::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Converts compound assignment statements to regular assignment statements,
|
||||
/// hoisting the LHS expression if necessary.
|
||||
|
@ -54,6 +54,6 @@ class ExpandCompoundAssignment final : public utils::Castable<ExpandCompoundAssi
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_EXPAND_COMPOUND_ASSIGNMENT_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using ExpandCompoundAssignmentTest = TransformTest;
|
||||
|
@ -744,4 +744,4 @@ fn main() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "src/tint/sem/struct.h"
|
||||
#include "src/tint/sem/variable.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset::BindingPoint);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::FirstIndexOffset::Data);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::FirstIndexOffset);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::FirstIndexOffset::BindingPoint);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::FirstIndexOffset::Data);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
// Uniform buffer member names
|
||||
|
@ -166,4 +166,4 @@ Transform::ApplyResult FirstIndexOffset::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Adds firstVertex/Instance (injected via root constants) to
|
||||
/// vertex/instance index builtins.
|
||||
|
@ -113,6 +113,6 @@ class FirstIndexOffset final : public utils::Castable<FirstIndexOffset, Transfor
|
|||
uint32_t group_ = 0;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_FIRST_INDEX_OFFSET_H_
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using FirstIndexOffsetTest = TransformTest;
|
||||
|
@ -618,4 +618,4 @@ fn func(i : u32) -> u32 {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#include "src/tint/ast/break_statement.h"
|
||||
#include "src/tint/program_builder.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ForLoopToLoop);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ForLoopToLoop);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
bool ShouldRun(const Program* program) {
|
||||
|
@ -82,4 +82,4 @@ Transform::ApplyResult ForLoopToLoop::Apply(const Program* src, const DataMap&,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// ForLoopToLoop is a Transform that converts a for-loop statement into a loop
|
||||
/// statement. This is required by the SPIR-V writer.
|
||||
|
@ -35,6 +35,6 @@ class ForLoopToLoop final : public utils::Castable<ForLoopToLoop, Transform> {
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_FOR_LOOP_TO_LOOP_H_
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using ForLoopToLoopTest = TransformTest;
|
||||
|
@ -369,4 +369,4 @@ fn f() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#include "src/tint/type/reference.h"
|
||||
#include "src/tint/utils/scoped_assignment.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::LocalizeStructArrayAssignment);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::LocalizeStructArrayAssignment);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// PIMPL state for the transform
|
||||
struct LocalizeStructArrayAssignment::State {
|
||||
|
@ -222,4 +222,4 @@ Transform::ApplyResult LocalizeStructArrayAssignment::Apply(const Program* src,
|
|||
return State{src}.Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// This transforms replaces assignment to dynamically-indexed fixed-size arrays
|
||||
/// in structs on shader-local variables with code that copies the arrays to a
|
||||
|
@ -45,6 +45,6 @@ class LocalizeStructArrayAssignment final
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_LOCALIZE_STRUCT_ARRAY_ASSIGNMENT_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using LocalizeStructArrayAssignmentTest = TransformTest;
|
||||
|
@ -844,4 +844,4 @@ fn main() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#include "src/tint/switch.h"
|
||||
#include "src/tint/utils/scoped_assignment.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::MergeReturn);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::MergeReturn);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -239,4 +239,4 @@ Transform::ApplyResult MergeReturn::Apply(const Program* src, const DataMap&, Da
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Merge return statements into a single return at the end of the function.
|
||||
class MergeReturn final : public utils::Castable<MergeReturn, Transform> {
|
||||
|
@ -33,6 +33,6 @@ class MergeReturn final : public utils::Castable<MergeReturn, Transform> {
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_MERGE_RETURN_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using MergeReturnTest = TransformTest;
|
||||
|
@ -857,4 +857,4 @@ fn foo() -> i32 {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#include "src/tint/sem/variable.h"
|
||||
#include "src/tint/utils/string.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::ModuleScopeVarToEntryPointParam);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::ModuleScopeVarToEntryPointParam);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using StructMemberList = utils::Vector<const ast::StructMember*, 8>;
|
||||
|
@ -607,4 +607,4 @@ Transform::ApplyResult ModuleScopeVarToEntryPointParam::Apply(const Program* src
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Move module-scope variables into the entry point as parameters.
|
||||
///
|
||||
|
@ -78,6 +78,6 @@ class ModuleScopeVarToEntryPointParam final
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_MODULE_SCOPE_VAR_TO_ENTRY_POINT_PARAM_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using ModuleScopeVarToEntryPointParamTest = TransformTest;
|
||||
|
@ -1369,4 +1369,4 @@ TEST_F(ModuleScopeVarToEntryPointParamTest, EmtpyModule) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#include "src/tint/sem/variable.h"
|
||||
#include "src/tint/type/texture_dimension.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::MultiplanarExternalTexture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::MultiplanarExternalTexture::NewBindingPoints);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::MultiplanarExternalTexture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::MultiplanarExternalTexture::NewBindingPoints);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
bool ShouldRun(const Program* program) {
|
||||
|
@ -524,4 +524,4 @@ Transform::ApplyResult MultiplanarExternalTexture::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "src/tint/sem/binding_point.h"
|
||||
#include "src/tint/sem/external_texture.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Within the MultiplanarExternalTexture transform, each instance of a
|
||||
/// texture_external binding is unpacked into two texture_2d<f32> bindings
|
||||
|
@ -52,7 +52,7 @@ class MultiplanarExternalTexture final
|
|||
/// NewBindingPoints is consumed by the MultiplanarExternalTexture transform.
|
||||
/// Data holds information about location of each texture_external binding and
|
||||
/// which binding slots it should expand into.
|
||||
struct NewBindingPoints final : public utils::Castable<Data, transform::Data> {
|
||||
struct NewBindingPoints final : public utils::Castable<NewBindingPoints, Data> {
|
||||
/// Constructor
|
||||
/// @param bm a map to the new binding slots to use.
|
||||
explicit NewBindingPoints(BindingsMap bm);
|
||||
|
@ -78,6 +78,6 @@ class MultiplanarExternalTexture final
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_MULTIPLANAR_EXTERNAL_TEXTURE_H_
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "src/tint/ast/transform/multiplanar_external_texture.h"
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using MultiplanarExternalTextureTest = TransformTest;
|
||||
|
@ -77,7 +77,8 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
}
|
||||
)";
|
||||
auto* expect =
|
||||
R"(error: missing new binding point data for tint::transform::MultiplanarExternalTexture)";
|
||||
"error: missing new binding point data for "
|
||||
"tint::ast::transform::MultiplanarExternalTexture";
|
||||
|
||||
auto got = Run<MultiplanarExternalTexture>(src);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
|
@ -1812,4 +1813,4 @@ alias ET = texture_external;
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
#include "src/tint/sem/function.h"
|
||||
#include "src/tint/utils/hash.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::NumWorkgroupsFromUniform);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::NumWorkgroupsFromUniform::Config);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::NumWorkgroupsFromUniform);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::NumWorkgroupsFromUniform::Config);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
bool ShouldRun(const Program* program) {
|
||||
|
@ -190,4 +190,4 @@ NumWorkgroupsFromUniform::Config::Config(std::optional<sem::BindingPoint> ubo_bp
|
|||
NumWorkgroupsFromUniform::Config::Config(const Config&) = default;
|
||||
NumWorkgroupsFromUniform::Config::~Config() = default;
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace tint {
|
|||
class CloneContext;
|
||||
} // namespace tint
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// NumWorkgroupsFromUniform is a transform that implements the `num_workgroups`
|
||||
/// builtin by loading it from a uniform buffer.
|
||||
|
@ -52,7 +52,7 @@ class NumWorkgroupsFromUniform final : public utils::Castable<NumWorkgroupsFromU
|
|||
~NumWorkgroupsFromUniform() override;
|
||||
|
||||
/// Configuration options for the NumWorkgroupsFromUniform transform.
|
||||
struct Config final : public utils::Castable<Data, transform::Data> {
|
||||
struct Config final : public utils::Castable<Config, Data> {
|
||||
/// Constructor
|
||||
/// @param ubo_bp the binding point to use for the generated uniform buffer. If ubo_bp
|
||||
/// contains no value, a free binding point will be used to ensure the generated program is
|
||||
|
@ -78,6 +78,6 @@ class NumWorkgroupsFromUniform final : public utils::Castable<NumWorkgroupsFromU
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_NUM_WORKGROUPS_FROM_UNIFORM_H_
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "src/tint/ast/transform/test_helper.h"
|
||||
#include "src/tint/ast/transform/unshadow.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using NumWorkgroupsFromUniformTest = TransformTest;
|
||||
|
@ -53,8 +53,7 @@ fn main(@builtin(num_workgroups) num_wgs : vec3<u32>) {
|
|||
)";
|
||||
|
||||
auto* expect =
|
||||
"error: missing transform data for "
|
||||
"tint::transform::NumWorkgroupsFromUniform";
|
||||
"error: missing transform data for tint::ast::transform::NumWorkgroupsFromUniform";
|
||||
|
||||
DataMap data;
|
||||
data.Add<CanonicalizeEntryPointIO::Config>(CanonicalizeEntryPointIO::ShaderStyle::kHlsl);
|
||||
|
@ -694,4 +693,4 @@ fn main3() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
#include "src/tint/utils/hashset.h"
|
||||
#include "src/tint/utils/vector.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::PackedVec3);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::PackedVec3);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// PIMPL state for the transform
|
||||
struct PackedVec3::State {
|
||||
|
@ -518,4 +518,4 @@ Transform::ApplyResult PackedVec3::Apply(const Program* src, const DataMap&, Dat
|
|||
return State{src}.Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// A transform to be used by the MSL backend which will:
|
||||
/// * Replace `vec3<T>` types with an internal `__packed_vec3` type when they are used in
|
||||
|
@ -54,6 +54,6 @@ class PackedVec3 final : public utils::Castable<PackedVec3, Transform> {
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_PACKED_VEC3_H_
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "src/tint/type/array.h"
|
||||
#include "src/tint/utils/string.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using PackedVec3Test = TransformTest;
|
||||
|
@ -8092,4 +8092,4 @@ fn f() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::PadStructs);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::PadStructs);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -157,4 +157,4 @@ Transform::ApplyResult PadStructs::Apply(const Program* src, const DataMap&, Dat
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// This transform turns all explicit alignment and sizing into padding
|
||||
/// members of structs. This is required for GLSL ES, since it not support
|
||||
|
@ -38,6 +38,6 @@ class PadStructs final : public utils::Castable<PadStructs, Transform> {
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_PAD_STRUCTS_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using PadStructsTest = TransformTest;
|
||||
|
@ -605,4 +605,4 @@ fn main() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
#include "src/tint/utils/map.h"
|
||||
#include "src/tint/utils/vector.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::PreservePadding);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::PreservePadding);
|
||||
|
||||
using namespace tint::number_suffixes; // NOLINT
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
PreservePadding::PreservePadding() = default;
|
||||
|
||||
|
@ -244,4 +244,4 @@ Transform::ApplyResult PreservePadding::Apply(const Program* program,
|
|||
return State(program).Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// Decompose assignments of whole structure and array types to preserve padding bytes.
|
||||
///
|
||||
|
@ -42,6 +42,6 @@ class PreservePadding final : public utils::Castable<PreservePadding, Transform>
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_PRESERVE_PADDING_H_
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using PreservePaddingTest = TransformTest;
|
||||
|
@ -776,4 +776,4 @@ fn foo() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "src/tint/type/struct.h"
|
||||
#include "src/tint/utils/hashset.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::PromoteInitializersToLet);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::PromoteInitializersToLet);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
PromoteInitializersToLet::PromoteInitializersToLet() = default;
|
||||
|
||||
|
@ -153,4 +153,4 @@ Transform::ApplyResult PromoteInitializersToLet::Apply(const Program* src,
|
|||
return Program(std::move(b));
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// A transform that hoists array and structure initializers, and identifiers resolving to a
|
||||
/// 'const' array to a 'let' variable, declared just before the statement of usage.
|
||||
|
@ -39,6 +39,6 @@ class PromoteInitializersToLet final : public utils::Castable<PromoteInitializer
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_PROMOTE_INITIALIZERS_TO_LET_H_
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using PromoteInitializersToLetTest = TransformTest;
|
||||
|
@ -1385,4 +1385,4 @@ fn f() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
#include "src/tint/transform/manager.h"
|
||||
#include "src/tint/utils/scoped_assignment.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::PromoteSideEffectsToDecl);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::PromoteSideEffectsToDecl);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
// Base state class for common members
|
||||
|
@ -674,10 +674,10 @@ PromoteSideEffectsToDecl::~PromoteSideEffectsToDecl() = default;
|
|||
Transform::ApplyResult PromoteSideEffectsToDecl::Apply(const Program* src,
|
||||
const DataMap& inputs,
|
||||
DataMap& outputs) const {
|
||||
transform::Manager manager;
|
||||
tint::transform::Manager manager;
|
||||
manager.Add<SimplifySideEffectStatements>();
|
||||
manager.Add<DecomposeSideEffects>();
|
||||
return manager.Apply(src, inputs, outputs);
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// A transform that hoists expressions with side-effects to variable
|
||||
/// declarations before the statement of usage with the goal of ensuring
|
||||
|
@ -37,6 +37,6 @@ class PromoteSideEffectsToDecl final : public utils::Castable<PromoteSideEffects
|
|||
DataMap& outputs) const override;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_PROMOTE_SIDE_EFFECTS_TO_DECL_H_
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using PromoteSideEffectsToDeclTest = TransformTest;
|
||||
|
@ -4134,4 +4134,4 @@ fn m() -> vec4<f32> {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
#include "src/tint/sem/while_statement.h"
|
||||
#include "src/tint/utils/map.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::RemoveContinueInSwitch);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::RemoveContinueInSwitch);
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// PIMPL state for the transform
|
||||
struct RemoveContinueInSwitch::State {
|
||||
|
@ -130,4 +130,4 @@ Transform::ApplyResult RemoveContinueInSwitch::Apply(const Program* src,
|
|||
return state.Run();
|
||||
}
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "src/tint/ast/transform/transform.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
|
||||
/// This transform replaces continue statements in switch cases with setting a
|
||||
/// bool variable, and checking if the variable is set after the switch to
|
||||
|
@ -40,6 +40,6 @@ class RemoveContinueInSwitch final : public utils::Castable<RemoveContinueInSwit
|
|||
struct State;
|
||||
};
|
||||
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
||||
#endif // SRC_TINT_AST_TRANSFORM_REMOVE_CONTINUE_IN_SWITCH_H_
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "src/tint/ast/transform/remove_continue_in_switch.h"
|
||||
#include "src/tint/ast/transform/test_helper.h"
|
||||
|
||||
namespace tint::transform {
|
||||
namespace tint::ast::transform {
|
||||
namespace {
|
||||
|
||||
using RemoveContinueInSwitchTest = TransformTest;
|
||||
|
@ -614,4 +614,4 @@ fn f() {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::transform
|
||||
} // namespace tint::ast::transform
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue