writer/hlsl: Simplify emission logic, clean up output

And fix issues where global variables would not be emitted unless they were transitively referenced by an entry point.

This change requires crbug.com/tint/697 to be fixed before landing.

Change-Id: I712bd9d369e08c9a3cdfb0f114c3609584f91f28
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54241
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-06-16 09:19:36 +00:00 committed by Ben Clayton
parent 944c5617ca
commit 5d2f34ecf2
935 changed files with 3850 additions and 6868 deletions

View File

@ -911,7 +911,6 @@ if(${TINT_BUILD_TESTS})
writer/hlsl/generator_impl_constructor_test.cc writer/hlsl/generator_impl_constructor_test.cc
writer/hlsl/generator_impl_continue_test.cc writer/hlsl/generator_impl_continue_test.cc
writer/hlsl/generator_impl_discard_test.cc writer/hlsl/generator_impl_discard_test.cc
writer/hlsl/generator_impl_function_entry_point_data_test.cc
writer/hlsl/generator_impl_function_test.cc writer/hlsl/generator_impl_function_test.cc
writer/hlsl/generator_impl_identifier_test.cc writer/hlsl/generator_impl_identifier_test.cc
writer/hlsl/generator_impl_if_test.cc writer/hlsl/generator_impl_if_test.cc

View File

@ -26,6 +26,7 @@ class Expression;
class Function; class Function;
class MemberAccessorExpression; class MemberAccessorExpression;
class Statement; class Statement;
class Struct;
class StructMember; class StructMember;
class Type; class Type;
class TypeDecl; class TypeDecl;
@ -59,6 +60,7 @@ struct TypeMappings {
StructMember* operator()(ast::StructMember*); StructMember* operator()(ast::StructMember*);
Type* operator()(ast::Type*); Type* operator()(ast::Type*);
Type* operator()(ast::TypeDecl*); Type* operator()(ast::TypeDecl*);
Struct* operator()(ast::Struct*);
Variable* operator()(ast::Variable*); Variable* operator()(ast::Variable*);
//! @endcond //! @endcond
}; };

View File

@ -43,10 +43,6 @@ namespace writer {
namespace hlsl { namespace hlsl {
namespace { namespace {
const char kInStructNameSuffix[] = "in";
const char kOutStructNameSuffix[] = "out";
const char kTintStructInVarPrefix[] = "tint_in";
const char kTintStructOutVarPrefix[] = "tint_out";
const char kTempNamePrefix[] = "tint_tmp"; const char kTempNamePrefix[] = "tint_tmp";
const char kSpecConstantPrefix[] = "WGSL_SPEC_CONSTANT_"; const char kSpecConstantPrefix[] = "WGSL_SPEC_CONSTANT_";
@ -116,110 +112,59 @@ GeneratorImpl::GeneratorImpl(const Program* program)
GeneratorImpl::~GeneratorImpl() = default; GeneratorImpl::~GeneratorImpl() = default;
bool GeneratorImpl::Generate(std::ostream& out) { bool GeneratorImpl::Generate(std::ostream& out) {
for (auto* global : builder_.AST().GlobalVariables()) { std::stringstream pending;
register_global(global); const TypeInfo* last_kind = nullptr;
}
for (auto* const ty : builder_.AST().TypeDecls()) { for (auto* decl : builder_.AST().GlobalDeclarations()) {
if (ty->Is<ast::Alias>()) { if (decl->Is<ast::Alias>()) {
continue; continue; // Ignore aliases.
} }
if (!EmitTypeDecl(out, TypeOf(ty))) {
return false;
}
}
if (!builder_.AST().TypeDecls().empty()) {
out << std::endl;
}
for (auto* var : builder_.AST().GlobalVariables()) { // Emit a new line between declarations if the type of declaration has
if (!var->is_const()) { // changed, or we're about to emit a function
continue; auto* kind = &decl->TypeInfo();
if (pending.str().length() &&
(last_kind != kind || decl->Is<ast::Function>())) {
out << pending.str() << std::endl;
pending.str(std::string());
make_indent(out);
} }
if (!EmitProgramConstVariable(out, var)) { last_kind = kind;
if (auto* global = decl->As<ast::Variable>()) {
if (!EmitGlobalVariable(pending, global)) {
return false;
}
} else if (auto* str = decl->As<ast::Struct>()) {
if (!EmitStructType(pending, builder_.Sem().Get(str))) {
return false;
}
} else if (auto* func = decl->As<ast::Function>()) {
if (func->IsEntryPoint()) {
if (!EmitEntryPointFunction(pending, func)) {
return false;
}
} else {
if (!EmitFunction(pending, func)) {
return false;
}
}
} else {
TINT_ICE(diagnostics_)
<< "unhandled module-scope declaration: " << decl->TypeInfo().name;
return false; return false;
} }
} }
// emitted_globals is a set used to ensure that globals are emitted once even out << pending.str();
// if they are used by multiple entry points.
std::unordered_set<Symbol> emitted_globals;
// Make sure all entry point data is emitted before the entry point functions
for (auto* func : builder_.AST().Functions()) {
if (!func->IsEntryPoint()) {
continue;
}
if (!EmitEntryPointData(out, func, emitted_globals)) {
return false;
}
}
for (auto* func : builder_.AST().Functions()) {
if (!EmitFunction(out, func)) {
return false;
}
}
for (auto* func : builder_.AST().Functions()) {
if (!func->IsEntryPoint()) {
continue;
}
if (!EmitEntryPointFunction(out, func)) {
return false;
}
out << std::endl;
}
return true; return true;
} }
void GeneratorImpl::register_global(ast::Variable* global) {
auto* sem = builder_.Sem().Get(global);
global_variables_.set(global->symbol(), sem);
}
std::string GeneratorImpl::generate_name(const std::string& prefix) { std::string GeneratorImpl::generate_name(const std::string& prefix) {
return builder_.Symbols().NameFor(builder_.Symbols().New(prefix)); return builder_.Symbols().NameFor(builder_.Symbols().New(prefix));
} }
std::string GeneratorImpl::current_ep_var_name(VarType type) {
std::string name = "";
switch (type) {
case VarType::kIn: {
auto in_it = ep_sym_to_in_data_.find(current_ep_sym_);
if (in_it != ep_sym_to_in_data_.end()) {
name = in_it->second.var_name;
}
break;
}
case VarType::kOut: {
auto outit = ep_sym_to_out_data_.find(current_ep_sym_);
if (outit != ep_sym_to_out_data_.end()) {
name = outit->second.var_name;
}
break;
}
}
return name;
}
bool GeneratorImpl::EmitTypeDecl(std::ostream& out, const sem::Type* ty) {
make_indent(out);
if (auto* str = ty->As<sem::Struct>()) {
if (!EmitStructType(
out, str, builder_.Symbols().NameFor(str->Declaration()->name()))) {
return false;
}
} else {
TINT_UNREACHABLE(diagnostics_) << "declared type: " << ty->TypeInfo().name;
return false;
}
return true;
}
bool GeneratorImpl::EmitArrayAccessor(std::ostream& pre, bool GeneratorImpl::EmitArrayAccessor(std::ostream& pre,
std::ostream& out, std::ostream& out,
ast::ArrayAccessorExpression* expr) { ast::ArrayAccessorExpression* expr) {
@ -626,11 +571,6 @@ bool GeneratorImpl::EmitCall(std::ostream& pre,
auto name = builder_.Symbols().NameFor(ident->symbol()); auto name = builder_.Symbols().NameFor(ident->symbol());
auto caller_sym = ident->symbol(); auto caller_sym = ident->symbol();
auto it = ep_func_name_remapped_.find(current_ep_sym_.to_str() + "_" +
caller_sym.to_str());
if (it != ep_func_name_remapped_.end()) {
name = it->second;
}
auto* func = builder_.AST().Functions().Find(ident->symbol()); auto* func = builder_.AST().Functions().Find(ident->symbol());
if (func == nullptr) { if (func == nullptr) {
@ -641,27 +581,7 @@ bool GeneratorImpl::EmitCall(std::ostream& pre,
out << name << "("; out << name << "(";
auto* func_sem = builder_.Sem().Get(func);
bool first = true; bool first = true;
if (has_referenced_in_var_needing_struct(func_sem)) {
auto var_name = current_ep_var_name(VarType::kIn);
if (!var_name.empty()) {
out << var_name;
first = false;
}
}
if (has_referenced_out_var_needing_struct(func_sem)) {
auto var_name = current_ep_var_name(VarType::kOut);
if (!var_name.empty()) {
if (!first) {
out << ", ";
}
first = false;
out << var_name;
}
}
for (auto* param : params) { for (auto* param : params) {
if (!first) { if (!first) {
out << ", "; out << ", ";
@ -1469,37 +1389,10 @@ bool GeneratorImpl::EmitExpression(std::ostream& pre,
return false; return false;
} }
bool GeneratorImpl::global_is_in_struct(const sem::Variable* var) const {
auto& decorations = var->Declaration()->decorations();
if (ast::HasDecoration<ast::LocationDecoration>(decorations) ||
ast::HasDecoration<ast::BuiltinDecoration>(decorations)) {
return var->StorageClass() == ast::StorageClass::kInput ||
var->StorageClass() == ast::StorageClass::kOutput;
}
return false;
}
bool GeneratorImpl::EmitIdentifier(std::ostream&, bool GeneratorImpl::EmitIdentifier(std::ostream&,
std::ostream& out, std::ostream& out,
ast::IdentifierExpression* expr) { ast::IdentifierExpression* expr) {
auto* ident = expr->As<ast::IdentifierExpression>(); out << builder_.Symbols().NameFor(expr->symbol());
const sem::Variable* var = nullptr;
if (global_variables_.get(ident->symbol(), &var)) {
if (global_is_in_struct(var)) {
auto var_type = var->StorageClass() == ast::StorageClass::kInput
? VarType::kIn
: VarType::kOut;
auto name = current_ep_var_name(var_type);
if (name.empty()) {
diagnostics_.add_error("unable to find entry point data for variable");
return false;
}
out << name << ".";
}
}
out << builder_.Symbols().NameFor(ident->symbol());
return true; return true;
} }
@ -1558,154 +1451,28 @@ bool GeneratorImpl::EmitIf(std::ostream& out, ast::IfStatement* stmt) {
return true; return true;
} }
bool GeneratorImpl::has_referenced_in_var_needing_struct(
const sem::Function* func) {
for (auto data : func->ReferencedLocationVariables()) {
auto* var = data.first;
if (var->StorageClass() == ast::StorageClass::kInput) {
return true;
}
}
for (auto data : func->ReferencedBuiltinVariables()) {
auto* var = data.first;
if (var->StorageClass() == ast::StorageClass::kInput) {
return true;
}
}
return false;
}
bool GeneratorImpl::has_referenced_out_var_needing_struct(
const sem::Function* func) {
for (auto data : func->ReferencedLocationVariables()) {
auto* var = data.first;
if (var->StorageClass() == ast::StorageClass::kOutput) {
return true;
}
}
for (auto data : func->ReferencedBuiltinVariables()) {
auto* var = data.first;
if (var->StorageClass() == ast::StorageClass::kOutput) {
return true;
}
}
return false;
}
bool GeneratorImpl::has_referenced_var_needing_struct(
const sem::Function* func) {
for (auto data : func->ReferencedLocationVariables()) {
auto* var = data.first;
if (var->StorageClass() == ast::StorageClass::kOutput ||
var->StorageClass() == ast::StorageClass::kInput) {
return true;
}
}
for (auto data : func->ReferencedBuiltinVariables()) {
auto* var = data.first;
if (var->StorageClass() == ast::StorageClass::kOutput ||
var->StorageClass() == ast::StorageClass::kInput) {
return true;
}
}
return false;
}
bool GeneratorImpl::EmitFunction(std::ostream& out, ast::Function* func) { bool GeneratorImpl::EmitFunction(std::ostream& out, ast::Function* func) {
make_indent(out); make_indent(out);
// Entry points will be emitted later, skip for now. auto* sem = builder_.Sem().Get(func);
if (func->IsEntryPoint()) {
return true;
}
auto* func_sem = builder_.Sem().Get(func);
if (ast::HasDecoration<ast::InternalDecoration>(func->decorations())) { if (ast::HasDecoration<ast::InternalDecoration>(func->decorations())) {
// An internal function. Do not emit. // An internal function. Do not emit.
return true; return true;
} }
// TODO(dsinclair): This could be smarter. If the input/outputs for multiple if (!EmitType(out, sem->ReturnType(), ast::StorageClass::kNone,
// entry points are the same we could generate a single struct and then have
// this determine it's the same struct and just emit once.
bool emit_duplicate_functions = func_sem->AncestorEntryPoints().size() > 0 &&
has_referenced_var_needing_struct(func_sem);
if (emit_duplicate_functions) {
for (const auto& ep_sym : func_sem->AncestorEntryPoints()) {
if (!EmitFunctionInternal(out, func, emit_duplicate_functions, ep_sym)) {
return false;
}
out << std::endl;
}
} else {
// Emit as non-duplicated
if (!EmitFunctionInternal(out, func, false, Symbol())) {
return false;
}
out << std::endl;
}
return true;
}
bool GeneratorImpl::EmitFunctionInternal(std::ostream& out,
ast::Function* func_ast,
bool emit_duplicate_functions,
Symbol ep_sym) {
auto* func = builder_.Sem().Get(func_ast);
if (!EmitType(out, func->ReturnType(), ast::StorageClass::kNone,
ast::Access::kReadWrite, "")) { ast::Access::kReadWrite, "")) {
return false; return false;
} }
out << " "; out << " ";
std::string name; out << builder_.Symbols().NameFor(func->symbol()) << "(";
if (emit_duplicate_functions) {
auto ep_name = ep_sym.to_str();
// TODO(dsinclair): The SymbolToName should go away and just use
// to_str() here when the conversion is complete.
name = generate_name(builder_.Symbols().NameFor(func_ast->symbol()) + "_" +
builder_.Symbols().NameFor(ep_sym));
ep_func_name_remapped_[ep_name + "_" + func_ast->symbol().to_str()] = name;
} else {
name = builder_.Symbols().NameFor(func_ast->symbol());
}
out << name << "(";
bool first = true; bool first = true;
// If we're emitting duplicate functions that means the function takes for (auto* v : sem->Parameters()) {
// the stage_in or stage_out value from the entry point, emit them.
//
// We emit both of them if they're there regardless of if they're both used.
if (emit_duplicate_functions) {
auto in_it = ep_sym_to_in_data_.find(ep_sym);
if (in_it != ep_sym_to_in_data_.end()) {
out << "in " << in_it->second.struct_name << " "
<< in_it->second.var_name;
first = false;
}
auto outit = ep_sym_to_out_data_.find(ep_sym);
if (outit != ep_sym_to_out_data_.end()) {
if (!first) {
out << ", ";
}
out << "out " << outit->second.struct_name << " "
<< outit->second.var_name;
first = false;
}
}
for (auto* v : func->Parameters()) {
if (!first) { if (!first) {
out << ", "; out << ", ";
} }
@ -1739,301 +1506,199 @@ bool GeneratorImpl::EmitFunctionInternal(std::ostream& out,
out << ") "; out << ") ";
current_ep_sym_ = ep_sym; if (!EmitBlockAndNewline(out, func->body())) {
if (!EmitBlockAndNewline(out, func_ast->body())) {
return false; return false;
} }
current_ep_sym_ = Symbol();
return true; return true;
} }
bool GeneratorImpl::EmitEntryPointData( bool GeneratorImpl::EmitGlobalVariable(std::ostream& out,
std::ostream& out, ast::Variable* global) {
ast::Function* func, if (global->is_const()) {
std::unordered_set<Symbol>& emitted_globals) { return EmitProgramConstVariable(out, global);
std::vector<std::pair<const ast::Variable*, ast::Decoration*>> in_variables;
std::vector<std::pair<const ast::Variable*, ast::Decoration*>> outvariables;
auto* func_sem = builder_.Sem().Get(func);
auto func_sym = func->symbol();
// TODO(crbug.com/tint/697): Remove this.
for (auto data : func_sem->ReferencedLocationVariables()) {
auto* var = data.first;
auto* decl = var->Declaration();
auto* deco = data.second;
if (var->StorageClass() == ast::StorageClass::kInput) {
in_variables.push_back({decl, deco});
} else if (var->StorageClass() == ast::StorageClass::kOutput) {
outvariables.push_back({decl, deco});
}
} }
// TODO(crbug.com/tint/697): Remove this. auto* sem = builder_.Sem().Get(global);
for (auto data : func_sem->ReferencedBuiltinVariables()) { switch (sem->StorageClass()) {
auto* var = data.first; case ast::StorageClass::kUniform:
auto* decl = var->Declaration(); return EmitUniformVariable(out, sem);
auto* deco = data.second; case ast::StorageClass::kStorage:
return EmitStorageVariable(out, sem);
if (var->StorageClass() == ast::StorageClass::kInput) { case ast::StorageClass::kUniformConstant:
in_variables.push_back({decl, deco}); return EmitHandleVariable(out, sem);
} else if (var->StorageClass() == ast::StorageClass::kOutput) { case ast::StorageClass::kPrivate:
outvariables.push_back({decl, deco}); return EmitPrivateVariable(out, sem);
} case ast::StorageClass::kWorkgroup:
return EmitWorkgroupVariable(out, sem);
default:
break;
} }
bool emitted_uniform = false; TINT_ICE(diagnostics_) << "unhandled storage class " << sem->StorageClass();
for (auto data : func_sem->ReferencedUniformVariables()) { return false;
auto* var = data.first; }
auto& binding_point = data.second;
auto* decl = var->Declaration();
if (!emitted_globals.emplace(decl->symbol()).second) { bool GeneratorImpl::EmitUniformVariable(std::ostream& out,
continue; // Global already emitted const sem::Variable* var) {
} make_indent(out);
auto* type = var->Type()->UnwrapRef(); auto* decl = var->Declaration();
if (auto* strct = type->As<sem::Struct>()) { auto binding_point = decl->binding_point();
out << "ConstantBuffer<" auto* type = var->Type()->UnwrapRef();
<< builder_.Symbols().NameFor(strct->Declaration()->name()) << "> "
<< builder_.Symbols().NameFor(decl->symbol())
<< RegisterAndSpace('b', binding_point) << ";" << std::endl;
} else {
// TODO(dsinclair): There is outstanding spec work to require all uniform
// buffers to be [[block]] decorated, which means structs. This is
// currently not the case, so this code handles the cases where the data
// is not a block.
// Relevant: https://github.com/gpuweb/gpuweb/issues/1004
// https://github.com/gpuweb/gpuweb/issues/1008
auto name = "cbuffer_" + builder_.Symbols().NameFor(decl->symbol());
out << "cbuffer " << name << RegisterAndSpace('b', binding_point) << " {"
<< std::endl;
increment_indent(); if (auto* strct = type->As<sem::Struct>()) {
make_indent(out); out << "ConstantBuffer<"
if (!EmitType(out, type, var->StorageClass(), var->Access(), "")) { << builder_.Symbols().NameFor(strct->Declaration()->name()) << "> "
return false; << builder_.Symbols().NameFor(decl->symbol())
} << RegisterAndSpace('b', binding_point) << ";" << std::endl;
out << " " << builder_.Symbols().NameFor(decl->symbol()) << ";" } else {
<< std::endl; auto name = "cbuffer_" + builder_.Symbols().NameFor(decl->symbol());
decrement_indent(); out << "cbuffer " << name << RegisterAndSpace('b', binding_point) << " {"
out << "};" << std::endl; << std::endl;
}
emitted_uniform = true; increment_indent();
} make_indent(out);
if (emitted_uniform) { if (!EmitType(out, type, var->StorageClass(), var->Access(), "")) {
out << std::endl;
}
bool emitted_storagebuffer = false;
for (auto data : func_sem->ReferencedStorageBufferVariables()) {
auto* var = data.first;
auto& binding_point = data.second;
auto* decl = var->Declaration();
if (!emitted_globals.emplace(decl->symbol()).second) {
continue; // Global already emitted
}
auto* type = var->Type()->UnwrapRef();
if (!EmitType(out, type, ast::StorageClass::kStorage, var->Access(), "")) {
return false; return false;
} }
out << " " << builder_.Symbols().NameFor(decl->symbol()) << ";"
out << " " << builder_.Symbols().NameFor(decl->symbol()) << std::endl;
<< RegisterAndSpace(var->Access() == ast::Access::kRead ? 't' : 'u',
binding_point)
<< ";" << std::endl;
emitted_storagebuffer = true;
}
if (emitted_storagebuffer) {
out << std::endl;
}
// TODO(crbug.com/tint/697): Remove this.
if (!in_variables.empty()) {
auto in_struct_name = generate_name(builder_.Symbols().NameFor(func_sym) +
"_" + kInStructNameSuffix);
auto in_var_name = generate_name(kTintStructInVarPrefix);
ep_sym_to_in_data_[func_sym] = {in_struct_name, in_var_name};
make_indent(out);
out << "struct " << in_struct_name << " {" << std::endl;
increment_indent();
for (auto& data : in_variables) {
auto* var = data.first;
auto* deco = data.second;
auto* sem = builder_.Sem().Get(var);
auto* type = sem->Type()->UnwrapRef();
make_indent(out);
if (!EmitType(out, type, sem->StorageClass(), sem->Access(),
builder_.Symbols().NameFor(var->symbol()))) {
return false;
}
out << " " << builder_.Symbols().NameFor(var->symbol()) << " : ";
if (auto* location = deco->As<ast::LocationDecoration>()) {
if (func->pipeline_stage() == ast::PipelineStage::kCompute) {
diagnostics_.add_error(
"invalid location variable for pipeline stage");
return false;
}
out << "TEXCOORD" << location->value();
} else if (auto* builtin = deco->As<ast::BuiltinDecoration>()) {
auto attr = builtin_to_attribute(builtin->value());
if (attr.empty()) {
diagnostics_.add_error("unsupported builtin");
return false;
}
out << attr;
} else {
diagnostics_.add_error(
"unsupported variable decoration for entry point output");
return false;
}
out << ";" << std::endl;
}
decrement_indent(); decrement_indent();
make_indent(out); out << "};" << std::endl;
}
return true;
}
out << "};" << std::endl << std::endl; bool GeneratorImpl::EmitStorageVariable(std::ostream& out,
const sem::Variable* var) {
make_indent(out);
auto* decl = var->Declaration();
auto* type = var->Type()->UnwrapRef();
if (!EmitType(out, type, ast::StorageClass::kStorage, var->Access(), "")) {
return false;
} }
// TODO(crbug.com/tint/697): Remove this. out << " " << builder_.Symbols().NameFor(decl->symbol())
if (!outvariables.empty()) { << RegisterAndSpace(var->Access() == ast::Access::kRead ? 't' : 'u',
auto outstruct_name = generate_name(builder_.Symbols().NameFor(func_sym) + decl->binding_point())
"_" + kOutStructNameSuffix); << ";" << std::endl;
auto outvar_name = generate_name(kTintStructOutVarPrefix);
ep_sym_to_out_data_[func_sym] = {outstruct_name, outvar_name};
make_indent(out); return true;
out << "struct " << outstruct_name << " {" << std::endl; }
increment_indent(); bool GeneratorImpl::EmitHandleVariable(std::ostream& out,
for (auto& data : outvariables) { const sem::Variable* var) {
auto* var = data.first; make_indent(out);
auto* deco = data.second;
auto* sem = builder_.Sem().Get(var);
auto* type = sem->Type()->UnwrapRef();
make_indent(out); auto* decl = var->Declaration();
if (!EmitType(out, type, sem->StorageClass(), sem->Access(), auto* unwrapped_type = var->Type()->UnwrapRef();
builder_.Symbols().NameFor(var->symbol()))) {
return false;
}
out << " " << builder_.Symbols().NameFor(var->symbol()) << " : "; std::ostringstream constructor_out;
if (auto* constructor = decl->constructor()) {
if (auto* location = deco->As<ast::LocationDecoration>()) { if (!EmitExpression(out, constructor_out, constructor)) {
auto loc = location->value(); return false;
if (func->pipeline_stage() == ast::PipelineStage::kVertex) {
out << "TEXCOORD" << loc;
} else if (func->pipeline_stage() == ast::PipelineStage::kFragment) {
out << "SV_Target" << loc << "";
} else {
diagnostics_.add_error(
"invalid location variable for pipeline stage");
return false;
}
} else if (auto* builtin = deco->As<ast::BuiltinDecoration>()) {
auto attr = builtin_to_attribute(builtin->value());
if (attr.empty()) {
diagnostics_.add_error("unsupported builtin");
return false;
}
out << attr;
} else {
diagnostics_.add_error(
"unsupported variable decoration for entry point output");
return false;
}
out << ";" << std::endl;
}
decrement_indent();
make_indent(out);
out << "};" << std::endl << std::endl;
}
{
bool add_newline = false;
for (auto* var : func_sem->ReferencedModuleVariables()) {
auto* decl = var->Declaration();
auto* unwrapped_type = var->Type()->UnwrapRef();
if (!emitted_globals.emplace(decl->symbol()).second) {
continue; // Global already emitted
}
make_indent(out);
std::ostringstream constructor_out;
if (auto* constructor = decl->constructor()) {
if (!EmitExpression(out, constructor_out, constructor)) {
return false;
}
}
switch (var->StorageClass()) {
case ast::StorageClass::kUniformConstant:
break;
case ast::StorageClass::kPrivate:
out << "static ";
break;
case ast::StorageClass::kWorkgroup:
out << "groupshared ";
break;
default:
continue; // Not interested in this storage class
}
auto name = builder_.Symbols().NameFor(decl->symbol());
auto* type = var->Type()->UnwrapRef();
if (!EmitType(out, type, var->StorageClass(), var->Access(), name)) {
return false;
}
if (!type->Is<sem::Array>()) {
out << " " << name;
}
const char* register_space = nullptr;
if (unwrapped_type->Is<sem::Texture>()) {
register_space = "t";
if (auto* storage_tex = unwrapped_type->As<sem::StorageTexture>()) {
if (storage_tex->access() != ast::Access::kRead) {
register_space = "u";
}
}
} else if (unwrapped_type->Is<sem::Sampler>()) {
register_space = "s";
}
if (register_space) {
auto bp = decl->binding_point();
out << " : register(" << register_space << bp.binding->value()
<< ", space" << bp.group->value() << ")";
}
if (constructor_out.str().length()) {
out << " = " << constructor_out.str();
}
out << ";" << std::endl;
add_newline = true;
}
if (add_newline) {
out << std::endl;
} }
} }
auto name = builder_.Symbols().NameFor(decl->symbol());
auto* type = var->Type()->UnwrapRef();
if (!EmitType(out, type, var->StorageClass(), var->Access(), name)) {
return false;
}
if (!type->Is<sem::Array>()) {
out << " " << name;
}
const char* register_space = nullptr;
if (unwrapped_type->Is<sem::Texture>()) {
register_space = "t";
if (auto* storage_tex = unwrapped_type->As<sem::StorageTexture>()) {
if (storage_tex->access() != ast::Access::kRead) {
register_space = "u";
}
}
} else if (unwrapped_type->Is<sem::Sampler>()) {
register_space = "s";
}
if (register_space) {
auto bp = decl->binding_point();
out << " : register(" << register_space << bp.binding->value() << ", space"
<< bp.group->value() << ")";
}
if (constructor_out.str().length()) {
out << " = " << constructor_out.str();
}
out << ";" << std::endl;
return true;
}
bool GeneratorImpl::EmitPrivateVariable(std::ostream& out,
const sem::Variable* var) {
make_indent(out);
auto* decl = var->Declaration();
std::ostringstream constructor_out;
if (auto* constructor = decl->constructor()) {
if (!EmitExpression(out, constructor_out, constructor)) {
return false;
}
}
out << "static ";
auto name = builder_.Symbols().NameFor(decl->symbol());
auto* type = var->Type()->UnwrapRef();
if (!EmitType(out, type, var->StorageClass(), var->Access(), name)) {
return false;
}
if (!type->Is<sem::Array>()) {
out << " " << name;
}
if (constructor_out.str().length()) {
out << " = " << constructor_out.str();
}
out << ";" << std::endl;
return true;
}
bool GeneratorImpl::EmitWorkgroupVariable(std::ostream& out,
const sem::Variable* var) {
make_indent(out);
auto* decl = var->Declaration();
std::ostringstream constructor_out;
if (auto* constructor = decl->constructor()) {
if (!EmitExpression(out, constructor_out, constructor)) {
return false;
}
}
out << "groupshared ";
auto name = builder_.Symbols().NameFor(decl->symbol());
auto* type = var->Type()->UnwrapRef();
if (!EmitType(out, type, var->StorageClass(), var->Access(), name)) {
return false;
}
if (!type->Is<sem::Array>()) {
out << " " << name;
}
if (constructor_out.str().length()) {
out << " = " << constructor_out.str();
}
out << ";" << std::endl;
return true; return true;
} }
@ -2071,7 +1736,6 @@ bool GeneratorImpl::EmitEntryPointFunction(std::ostream& out,
ast::Function* func) { ast::Function* func) {
make_indent(out); make_indent(out);
current_ep_sym_ = func->symbol();
auto* func_sem = builder_.Sem().Get(func); auto* func_sem = builder_.Sem().Get(func);
if (func->pipeline_stage() == ast::PipelineStage::kCompute) { if (func->pipeline_stage() == ast::PipelineStage::kCompute) {
@ -2098,28 +1762,11 @@ bool GeneratorImpl::EmitEntryPointFunction(std::ostream& out,
make_indent(out); make_indent(out);
} }
auto outdata = ep_sym_to_out_data_.find(current_ep_sym_); out << func->return_type()->FriendlyName(builder_.Symbols());
bool has_outdata = outdata != ep_sym_to_out_data_.end();
if (has_outdata) { out << " " << builder_.Symbols().NameFor(func->symbol()) << "(";
// TODO(crbug.com/tint/697): Remove this.
if (!func->return_type()->Is<ast::Void>()) {
TINT_ICE(diagnostics_) << "Mixing module-scope variables and return "
"types for shader outputs";
}
out << outdata->second.struct_name;
} else {
out << func->return_type()->FriendlyName(builder_.Symbols());
}
// TODO(dsinclair): This should output the remapped name
out << " " << builder_.Symbols().NameFor(current_ep_sym_) << "(";
bool first = true; bool first = true;
// TODO(crbug.com/tint/697): Remove this.
auto in_data = ep_sym_to_in_data_.find(current_ep_sym_);
if (in_data != ep_sym_to_in_data_.end()) {
out << in_data->second.struct_name << " " << in_data->second.var_name;
first = false;
}
// Emit entry point parameters. // Emit entry point parameters.
for (auto* var : func->params()) { for (auto* var : func->params()) {
@ -2145,13 +1792,6 @@ bool GeneratorImpl::EmitEntryPointFunction(std::ostream& out,
increment_indent(); increment_indent();
if (has_outdata) {
make_indent(out);
out << outdata->second.struct_name << " " << outdata->second.var_name
<< " = (" << outdata->second.struct_name << ")0;" << std::endl;
}
generating_entry_point_ = true;
for (auto* s : *func->body()) { for (auto* s : *func->body()) {
if (!EmitStatement(out, s)) { if (!EmitStatement(out, s)) {
return false; return false;
@ -2165,14 +1805,11 @@ bool GeneratorImpl::EmitEntryPointFunction(std::ostream& out,
return false; return false;
} }
} }
generating_entry_point_ = false;
decrement_indent(); decrement_indent();
make_indent(out); make_indent(out);
out << "}" << std::endl; out << "}" << std::endl;
current_ep_sym_ = Symbol();
return true; return true;
} }
@ -2318,13 +1955,6 @@ bool GeneratorImpl::EmitReturn(std::ostream& out, ast::ReturnStatement* stmt) {
} }
out << pre.str(); out << pre.str();
out << "return " << ret_out.str(); out << "return " << ret_out.str();
} else if (generating_entry_point_) {
// TODO(crbug.com/tint/697): Remove this (and generating_entry_point_)
out << "return";
auto outdata = ep_sym_to_out_data_.find(current_ep_sym_);
if (outdata != ep_sym_to_out_data_.end()) {
out << " " << outdata->second.var_name;
}
} else { } else {
out << "return"; out << "return";
} }
@ -2567,9 +2197,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitStructType(std::ostream& out, bool GeneratorImpl::EmitStructType(std::ostream& out, const sem::Struct* str) {
const sem::Struct* str,
const std::string& name) {
auto storage_class_uses = str->StorageClassUsage(); auto storage_class_uses = str->StorageClassUsage();
if (storage_class_uses.size() == if (storage_class_uses.size() ==
storage_class_uses.count(ast::StorageClass::kStorage)) { storage_class_uses.count(ast::StorageClass::kStorage)) {
@ -2579,6 +2207,7 @@ bool GeneratorImpl::EmitStructType(std::ostream& out,
return true; return true;
} }
auto name = builder_.Symbols().NameFor(str->Declaration()->name());
out << "struct " << name << " {" << std::endl; out << "struct " << name << " {" << std::endl;
increment_indent(); increment_indent();

View File

@ -57,11 +57,6 @@ class GeneratorImpl : public TextGenerator {
/// @returns true on successful generation; false otherwise /// @returns true on successful generation; false otherwise
bool Generate(std::ostream& out); bool Generate(std::ostream& out);
/// Handles generating a declared type
/// @param out the output stream
/// @param ty the declared type to generate
/// @returns true if the declared type was emitted
bool EmitTypeDecl(std::ostream& out, const sem::Type* ty);
/// Handles an array accessor expression /// Handles an array accessor expression
/// @param pre the preamble for the expression stream /// @param pre the preamble for the expression stream
/// @param out the output of the expression stream /// @param out the output of the expression stream
@ -229,25 +224,43 @@ class GeneratorImpl : public TextGenerator {
/// @param func the function to generate /// @param func the function to generate
/// @returns true if the function was emitted /// @returns true if the function was emitted
bool EmitFunction(std::ostream& out, ast::Function* func); bool EmitFunction(std::ostream& out, ast::Function* func);
/// Internal helper for emitting functions
/// Handles emitting a global variable
/// @param out the output stream /// @param out the output stream
/// @param func the function to emit /// @param global the global variable
/// @param emit_duplicate_functions set true if we need to duplicate per entry /// @returns true on success
/// point bool EmitGlobalVariable(std::ostream& out, ast::Variable* global);
/// @param ep_sym the current entry point or symbol::kInvalid if none set
/// @returns true if the function was emitted. /// Handles emitting a global variable with the uniform storage class
bool EmitFunctionInternal(std::ostream& out,
ast::Function* func,
bool emit_duplicate_functions,
Symbol ep_sym);
/// Handles emitting information for an entry point
/// @param out the output stream /// @param out the output stream
/// @param func the entry point /// @param var the global variable
/// @param emitted_globals the set of globals emitted over all entry points /// @returns true on success
/// @returns true if the entry point data was emitted bool EmitUniformVariable(std::ostream& out, const sem::Variable* var);
bool EmitEntryPointData(std::ostream& out,
ast::Function* func, /// Handles emitting a global variable with the storage storage class
std::unordered_set<Symbol>& emitted_globals); /// @param out the output stream
/// @param var the global variable
/// @returns true on success
bool EmitStorageVariable(std::ostream& out, const sem::Variable* var);
/// Handles emitting a global variable with the handle storage class
/// @param out the output stream
/// @param var the global variable
/// @returns true on success
bool EmitHandleVariable(std::ostream& out, const sem::Variable* var);
/// Handles emitting a global variable with the private storage class
/// @param out the output stream
/// @param var the global variable
/// @returns true on success
bool EmitPrivateVariable(std::ostream& out, const sem::Variable* var);
/// Handles emitting a global variable with the workgroup storage class
/// @param out the output stream
/// @param var the global variable
/// @returns true on success
bool EmitWorkgroupVariable(std::ostream& out, const sem::Variable* var);
/// Handles emitting the entry point function /// Handles emitting the entry point function
/// @param out the output stream /// @param out the output stream
/// @param func the entry point /// @param func the entry point
@ -314,11 +327,8 @@ class GeneratorImpl : public TextGenerator {
/// Handles generating a structure declaration /// Handles generating a structure declaration
/// @param out the output stream /// @param out the output stream
/// @param ty the struct to generate /// @param ty the struct to generate
/// @param name the struct name
/// @returns true if the struct is emitted /// @returns true if the struct is emitted
bool EmitStructType(std::ostream& out, bool EmitStructType(std::ostream& out, const sem::Struct* ty);
const sem::Struct* ty,
const std::string& name);
/// Handles a unary op expression /// Handles a unary op expression
/// @param pre the preamble for the expression stream /// @param pre the preamble for the expression stream
/// @param out the output of the expression stream /// @param out the output of the expression stream
@ -343,13 +353,6 @@ class GeneratorImpl : public TextGenerator {
/// @returns true if the variable was emitted /// @returns true if the variable was emitted
bool EmitProgramConstVariable(std::ostream& out, const ast::Variable* var); bool EmitProgramConstVariable(std::ostream& out, const ast::Variable* var);
/// Registers the given global with the generator
/// @param global the global to register
void register_global(ast::Variable* global);
/// Checks if the global variable is in an input or output struct
/// @param var the variable to check
/// @returns true if the global is in an input or output struct
bool global_is_in_struct(const sem::Variable* var) const;
/// Handles generating a builtin method name /// Handles generating a builtin method name
/// @param intrinsic the semantic info for the intrinsic /// @param intrinsic the semantic info for the intrinsic
/// @returns the name or "" if not valid /// @returns the name or "" if not valid
@ -358,19 +361,6 @@ class GeneratorImpl : public TextGenerator {
/// @param builtin the builtin to convert /// @param builtin the builtin to convert
/// @returns the string name of the builtin or blank on error /// @returns the string name of the builtin or blank on error
std::string builtin_to_attribute(ast::Builtin builtin) const; std::string builtin_to_attribute(ast::Builtin builtin) const;
/// Determines if the function needs the input struct passed to it.
/// @param func the function to check
/// @returns true if there are input struct variables used in the function
bool has_referenced_in_var_needing_struct(const sem::Function* func);
/// Determines if the function needs the output struct passed to it.
/// @param func the function to check
/// @returns true if there are output struct variables used in the function
bool has_referenced_out_var_needing_struct(const sem::Function* func);
/// Determines if any used program variable requires an input or output
/// struct.
/// @param func the function to check
/// @returns true if an input or output struct is required.
bool has_referenced_var_needing_struct(const sem::Function* func);
/// Generate a unique name /// Generate a unique name
/// @param prefix the name prefix /// @param prefix the name prefix
@ -385,7 +375,6 @@ class GeneratorImpl : public TextGenerator {
std::string var_name; std::string var_name;
}; };
std::string current_ep_var_name(VarType type);
std::string get_buffer_name(ast::Expression* expr); std::string get_buffer_name(ast::Expression* expr);
/// @returns the resolved type of the ast::Expression `expr` /// @returns the resolved type of the ast::Expression `expr`
@ -428,17 +417,7 @@ class GeneratorImpl : public TextGenerator {
} }
ProgramBuilder builder_; ProgramBuilder builder_;
Symbol current_ep_sym_;
bool generating_entry_point_ = false;
std::function<bool(std::ostream& out)> emit_continuing_; std::function<bool(std::ostream& out)> emit_continuing_;
ScopeStack<const sem::Variable*> global_variables_;
std::unordered_map<Symbol, EntryPointData> ep_sym_to_in_data_;
std::unordered_map<Symbol, EntryPointData> ep_sym_to_out_data_;
// This maps an input of "<entry_point_name>_<function_name>" to a remapped
// function name. If there is no entry for a given key then function did
// not need to be remapped for the entry point and can be emitted directly.
std::unordered_map<std::string, std::string> ep_func_name_remapped_;
}; };
} // namespace hlsl } // namespace hlsl

View File

@ -1,320 +0,0 @@
// Copyright 2020 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/ast/stage_decoration.h"
#include "src/writer/hlsl/test_helper.h"
namespace tint {
namespace writer {
namespace hlsl {
namespace {
using HlslGeneratorImplTest_EntryPoint = TestHelper;
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Vertex_Input) {
// [[location 0]] var<in> foo : f32;
// [[location 1]] var<in> bar : i32;
//
// struct vtx_main_in {
// float foo : TEXCOORD0;
// int bar : TEXCOORD1;
// };
Global("foo", ty.f32(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Location(0),
});
Global("bar", ty.i32(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Location(1),
});
Func("vtx_main", ast::VariableList{}, ty.vec4<f32>(),
ast::StatementList{
Assign("foo", "foo"),
Assign("bar", "bar"),
Return(Construct(ty.vec4<f32>())),
},
{Stage(ast::PipelineStage::kVertex)},
{Builtin(ast::Builtin::kPosition)});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(result(), R"(struct vtx_main_in {
float foo : TEXCOORD0;
int bar : TEXCOORD1;
};
)");
}
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Vertex_Output) {
// [[location 0]] var<out> foo : f32;
// [[location 1]] var<out> bar : i32;
//
// struct vtx_main_out {
// float foo : TEXCOORD0;
// int bar : TEXCOORD1;
// };
Global("foo", ty.f32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Location(0),
});
Global("bar", ty.i32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Location(1),
});
Func("vtx_main", ast::VariableList{}, ty.vec4<f32>(),
ast::StatementList{
Assign("foo", "foo"),
Assign("bar", "bar"),
Return(Construct(ty.vec4<f32>())),
},
{Stage(ast::PipelineStage::kVertex)},
{Builtin(ast::Builtin::kPosition)});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(result(), R"(struct vtx_main_out {
float foo : TEXCOORD0;
int bar : TEXCOORD1;
};
)");
}
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Fragment_Input) {
// [[location 0]] var<in> foo : f32;
// [[location 1]] var<in> bar : i32;
//
// struct frag_main_in {
// float foo : TEXCOORD0;
// int bar : TEXCOORD1;
// };
Global("foo", ty.f32(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Location(0),
});
Global("bar", ty.i32(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Location(1),
});
Func("main", ast::VariableList{}, ty.void_(),
ast::StatementList{
Assign("foo", "foo"),
Assign("bar", "bar"),
},
ast::DecorationList{
Stage(ast::PipelineStage::kFragment),
});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(result(), R"(struct main_in {
float foo : TEXCOORD0;
int bar : TEXCOORD1;
};
)");
}
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Fragment_Output) {
// [[location 0]] var<out> foo : f32;
// [[location 1]] var<out> bar : i32;
//
// struct frag_main_out {
// float foo : SV_Target0;
// int bar : SV_Target1;
// };
Global("foo", ty.f32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Location(0),
});
Global("bar", ty.i32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Location(1),
});
Func("main", ast::VariableList{}, ty.void_(),
ast::StatementList{
Assign("foo", "foo"),
Assign("bar", "bar"),
},
ast::DecorationList{
Stage(ast::PipelineStage::kFragment),
});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(result(), R"(struct main_out {
float foo : SV_Target0;
int bar : SV_Target1;
};
)");
}
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Compute_Input) {
// [[location 0]] var<in> foo : f32;
// [[location 1]] var<in> bar : i32;
//
// -> Error, not allowed
Global("foo", ty.f32(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Location(0),
});
Global("bar", ty.i32(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Location(1),
});
Func("main", ast::VariableList{}, ty.void_(),
ast::StatementList{
Assign("foo", "foo"),
Assign("bar", "bar"),
},
ast::DecorationList{
Stage(ast::PipelineStage::kCompute),
});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_FALSE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(gen.error(),
R"(error: invalid location variable for pipeline stage)");
}
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Compute_Output) {
// [[location 0]] var<out> foo : f32;
// [[location 1]] var<out> bar : i32;
//
// -> Error not allowed
Global("foo", ty.f32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Location(0),
});
Global("bar", ty.i32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Location(1),
});
Func("main", ast::VariableList{}, ty.void_(),
ast::StatementList{
Assign("foo", "foo"),
Assign("bar", "bar"),
},
ast::DecorationList{
Stage(ast::PipelineStage::kCompute),
});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_FALSE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(gen.error(),
R"(error: invalid location variable for pipeline stage)");
}
TEST_F(HlslGeneratorImplTest_EntryPoint,
Emit_Function_EntryPointData_Builtins) {
// [[builtin position]] var<in> coord : vec4<f32>;
// [[builtin frag_depth]] var<out> depth : f32;
//
// struct main_in {
// float4 coord : SV_Position;
// };
//
// struct main_out {
// float depth : SV_Depth;
// };
Global("coord", ty.vec4<f32>(), ast::StorageClass::kInput, nullptr,
ast::DecorationList{
Builtin(ast::Builtin::kPosition),
});
Global("depth", ty.f32(), ast::StorageClass::kOutput, nullptr,
ast::DecorationList{
Builtin(ast::Builtin::kFragDepth),
});
Func("main", ast::VariableList{}, ty.void_(),
ast::StatementList{
Assign("depth", MemberAccessor("coord", "x")),
},
ast::DecorationList{
Stage(ast::PipelineStage::kFragment),
});
std::unordered_set<Symbol> globals;
GeneratorImpl& gen = Build();
auto* func = program->AST().Functions()[0];
ASSERT_TRUE(gen.EmitEntryPointData(out, func, globals)) << gen.error();
EXPECT_EQ(result(), R"(struct main_in {
float4 coord : SV_Position;
};
struct main_out {
float depth : SV_Depth;
};
)");
}
} // namespace
} // namespace hlsl
} // namespace writer
} // namespace tint

View File

@ -42,7 +42,6 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function) {
EXPECT_EQ(result(), R"( void my_func() { EXPECT_EQ(result(), R"( void my_func() {
return; return;
} }
)"); )");
} }
@ -77,7 +76,6 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithParams) {
EXPECT_EQ(result(), R"( void my_func(float a, int b) { EXPECT_EQ(result(), R"( void my_func(float a, int b) {
return; return;
} }
)"); )");
} }
@ -94,7 +92,6 @@ TEST_F(HlslGeneratorImplTest_Function,
EXPECT_EQ(result(), R"(void main() { EXPECT_EQ(result(), R"(void main() {
return; return;
} }
)"); )");
} }
@ -111,7 +108,6 @@ TEST_F(HlslGeneratorImplTest_Function, PtrParameter) {
EXPECT_THAT(result(), HasSubstr(R"(float f(inout float foo) { EXPECT_THAT(result(), HasSubstr(R"(float f(inout float foo) {
return foo; return foo;
} }
)")); )"));
} }
@ -139,7 +135,6 @@ tint_symbol_2 frag_main(tint_symbol_1 tint_symbol) {
const tint_symbol_2 tint_symbol_3 = {foo}; const tint_symbol_2 tint_symbol_3 = {foo};
return tint_symbol_3; return tint_symbol_3;
} }
)"); )");
} }
@ -170,7 +165,6 @@ tint_symbol_2 frag_main(tint_symbol_1 tint_symbol) {
const tint_symbol_2 tint_symbol_3 = {coord.x}; const tint_symbol_2 tint_symbol_3 = {coord.x};
return tint_symbol_3; return tint_symbol_3;
} }
)"); )");
} }
@ -223,11 +217,6 @@ struct tint_symbol {
float col2 : TEXCOORD2; float col2 : TEXCOORD2;
float4 pos : SV_Position; float4 pos : SV_Position;
}; };
struct tint_symbol_3 {
float col1 : TEXCOORD1;
float col2 : TEXCOORD2;
float4 pos : SV_Position;
};
tint_symbol vert_main() { tint_symbol vert_main() {
const Interface tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f), 0.5f, 0.25f}; const Interface tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f), 0.5f, 0.25f};
@ -235,6 +224,12 @@ tint_symbol vert_main() {
return tint_symbol_4; return tint_symbol_4;
} }
struct tint_symbol_3 {
float col1 : TEXCOORD1;
float col2 : TEXCOORD2;
float4 pos : SV_Position;
};
void frag_main(tint_symbol_3 tint_symbol_2) { void frag_main(tint_symbol_3 tint_symbol_2) {
const Interface inputs = {tint_symbol_2.pos, tint_symbol_2.col1, tint_symbol_2.col2}; const Interface inputs = {tint_symbol_2.pos, tint_symbol_2.col1, tint_symbol_2.col2};
const float r = inputs.col1; const float r = inputs.col1;
@ -242,7 +237,6 @@ void frag_main(tint_symbol_3 tint_symbol_2) {
const float4 p = inputs.pos; const float4 p = inputs.pos;
return; return;
} }
)"); )");
} }
@ -285,30 +279,31 @@ TEST_F(HlslGeneratorImplTest_Function,
EXPECT_EQ(result(), R"(struct VertexOutput { EXPECT_EQ(result(), R"(struct VertexOutput {
float4 pos; float4 pos;
}; };
struct tint_symbol {
float4 pos : SV_Position;
};
struct tint_symbol_2 {
float4 pos : SV_Position;
};
VertexOutput foo(float x) { VertexOutput foo(float x) {
const VertexOutput tint_symbol_4 = {float4(x, x, x, 1.0f)}; const VertexOutput tint_symbol_4 = {float4(x, x, x, 1.0f)};
return tint_symbol_4; return tint_symbol_4;
} }
struct tint_symbol {
float4 pos : SV_Position;
};
tint_symbol vert_main1() { tint_symbol vert_main1() {
const VertexOutput tint_symbol_1 = {foo(0.5f)}; const VertexOutput tint_symbol_1 = {foo(0.5f)};
const tint_symbol tint_symbol_5 = {tint_symbol_1.pos}; const tint_symbol tint_symbol_5 = {tint_symbol_1.pos};
return tint_symbol_5; return tint_symbol_5;
} }
struct tint_symbol_2 {
float4 pos : SV_Position;
};
tint_symbol_2 vert_main2() { tint_symbol_2 vert_main2() {
const VertexOutput tint_symbol_3 = {foo(0.25f)}; const VertexOutput tint_symbol_3 = {foo(0.25f)};
const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.pos}; const tint_symbol_2 tint_symbol_6 = {tint_symbol_3.pos};
return tint_symbol_6; return tint_symbol_6;
} }
)"); )");
} }
@ -360,7 +355,6 @@ void frag_main() {
float v = sub_func(1.0f); float v = sub_func(1.0f);
return; return;
} }
)"); )");
} }
@ -400,7 +394,6 @@ void frag_main() {
float v = uniforms.coord.x; float v = uniforms.coord.x;
return; return;
} }
)"); )");
} }
@ -436,14 +429,12 @@ TEST_F(HlslGeneratorImplTest_Function,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), EXPECT_EQ(result(),
R"( R"(RWByteAddressBuffer coord : register(u0, space1);
RWByteAddressBuffer coord : register(u0, space1);
void frag_main() { void frag_main() {
float v = asfloat(coord.Load(4u)); float v = asfloat(coord.Load(4u));
return; return;
} }
)"); )");
} }
@ -478,14 +469,12 @@ TEST_F(HlslGeneratorImplTest_Function,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), EXPECT_EQ(result(),
R"( R"(ByteAddressBuffer coord : register(t0, space1);
ByteAddressBuffer coord : register(t0, space1);
void frag_main() { void frag_main() {
float v = asfloat(coord.Load(4u)); float v = asfloat(coord.Load(4u));
return; return;
} }
)"); )");
} }
@ -517,14 +506,12 @@ TEST_F(HlslGeneratorImplTest_Function,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), EXPECT_EQ(result(),
R"( R"(RWByteAddressBuffer coord : register(u0, space1);
RWByteAddressBuffer coord : register(u0, space1);
void frag_main() { void frag_main() {
coord.Store(4u, asuint(2.0f)); coord.Store(4u, asuint(2.0f));
return; return;
} }
)"); )");
} }
@ -557,171 +544,12 @@ TEST_F(HlslGeneratorImplTest_Function,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), EXPECT_EQ(result(),
R"( R"(RWByteAddressBuffer coord : register(u0, space1);
RWByteAddressBuffer coord : register(u0, space1);
void frag_main() { void frag_main() {
coord.Store(4u, asuint(2.0f)); coord.Store(4u, asuint(2.0f));
return; return;
} }
)");
}
// TODO(crbug.com/tint/697): Remove this test
TEST_F(
HlslGeneratorImplTest_Function,
Emit_Decoration_Called_By_EntryPoints_WithLocationGlobals_And_Params) { // NOLINT
Global("foo", ty.f32(), ast::StorageClass::kInput,
ast::DecorationList{
Location(0),
});
Global("bar", ty.f32(), ast::StorageClass::kOutput,
ast::DecorationList{
Location(1),
});
Global("val", ty.f32(), ast::StorageClass::kOutput,
ast::DecorationList{
Location(0),
});
Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(),
{
Assign("bar", "foo"),
Assign("val", "param"),
Return("foo"),
});
Func("ep_1", ast::VariableList{}, ty.void_(),
{
Assign("bar", Call("sub_func", 1.0f)),
Return(),
},
{
Stage(ast::PipelineStage::kFragment),
});
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(struct ep_1_in {
float foo : TEXCOORD0;
};
struct ep_1_out {
float bar : SV_Target1;
float val : SV_Target0;
};
float sub_func_ep_1(in ep_1_in tint_in, out ep_1_out tint_out, float param) {
tint_out.bar = tint_in.foo;
tint_out.val = param;
return tint_in.foo;
}
ep_1_out ep_1(ep_1_in tint_in) {
ep_1_out tint_out = (ep_1_out)0;
tint_out.bar = sub_func_ep_1(tint_in, tint_out, 1.0f);
return tint_out;
}
)");
}
TEST_F(HlslGeneratorImplTest_Function,
Emit_Decoration_Called_By_EntryPoints_NoUsedGlobals) {
Global("depth", ty.f32(), ast::StorageClass::kOutput,
ast::DecorationList{
Builtin(ast::Builtin::kFragDepth),
});
Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(),
{
Return("param"),
});
Func("ep_1", ast::VariableList{}, ty.void_(),
{
Assign("depth", Call("sub_func", 1.0f)),
Return(),
},
{
Stage(ast::PipelineStage::kFragment),
});
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(struct ep_1_out {
float depth : SV_Depth;
};
float sub_func(float param) {
return param;
}
ep_1_out ep_1() {
ep_1_out tint_out = (ep_1_out)0;
tint_out.depth = sub_func(1.0f);
return tint_out;
}
)");
}
// TODO(crbug.com/tint/697): Remove this test
TEST_F(
HlslGeneratorImplTest_Function,
Emit_Decoration_Called_By_EntryPoints_WithBuiltinGlobals_And_Params) { // NOLINT
Global("coord", ty.vec4<f32>(), ast::StorageClass::kInput,
ast::DecorationList{
Builtin(ast::Builtin::kPosition),
});
Global("depth", ty.f32(), ast::StorageClass::kOutput,
ast::DecorationList{
Builtin(ast::Builtin::kFragDepth),
});
Func("sub_func", ast::VariableList{Param("param", ty.f32())}, ty.f32(),
{
Assign("depth", MemberAccessor("coord", "x")),
Return("param"),
});
Func("ep_1", ast::VariableList{}, ty.void_(),
{
Assign("depth", Call("sub_func", 1.0f)),
Return(),
},
{
Stage(ast::PipelineStage::kFragment),
});
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(struct ep_1_in {
float4 coord : SV_Position;
};
struct ep_1_out {
float depth : SV_Depth;
};
float sub_func_ep_1(in ep_1_in tint_in, out ep_1_out tint_out, float param) {
tint_out.depth = tint_in.coord.x;
return param;
}
ep_1_out ep_1(ep_1_in tint_in) {
ep_1_out tint_out = (ep_1_out)0;
tint_out.depth = sub_func_ep_1(tint_in, tint_out, 1.0f);
return tint_out;
}
)"); )");
} }
@ -769,7 +597,6 @@ void frag_main() {
float v = sub_func(1.0f); float v = sub_func(1.0f);
return; return;
} }
)"); )");
} }
@ -805,8 +632,7 @@ TEST_F(HlslGeneratorImplTest_Function,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), EXPECT_EQ(result(),
R"( R"(RWByteAddressBuffer coord : register(u0, space1);
RWByteAddressBuffer coord : register(u0, space1);
float sub_func(float param) { float sub_func(float param) {
return asfloat(coord.Load(0u)); return asfloat(coord.Load(0u));
@ -816,46 +642,6 @@ void frag_main() {
float v = sub_func(1.0f); float v = sub_func(1.0f);
return; return;
} }
)");
}
TEST_F(HlslGeneratorImplTest_Function,
Emit_Decoration_EntryPoints_WithGlobal_Nested_Return) {
Global("bar", ty.f32(), ast::StorageClass::kOutput,
ast::DecorationList{
Location(1),
});
Func(
"ep_1", ast::VariableList{}, ty.void_(),
{
Assign("bar", Expr(1.0f)),
create<ast::IfStatement>(create<ast::BinaryExpression>(
ast::BinaryOp::kEqual, Expr(1), Expr(1)),
Block(Return()), ast::ElseStatementList{}),
Return(),
},
{
Stage(ast::PipelineStage::kFragment),
});
GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(struct ep_1_out {
float bar : SV_Target1;
};
ep_1_out ep_1() {
ep_1_out tint_out = (ep_1_out)0;
tint_out.bar = 1.0f;
if ((1 == 1)) {
return tint_out;
}
return tint_out;
}
)"); )");
} }
@ -872,7 +658,6 @@ TEST_F(HlslGeneratorImplTest_Function,
EXPECT_EQ(result(), R"(void tint_symbol() { EXPECT_EQ(result(), R"(void tint_symbol() {
return; return;
} }
)"); )");
} }
@ -892,7 +677,6 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Decoration_EntryPoint_Compute) {
void main() { void main() {
return; return;
} }
)"); )");
} }
@ -911,7 +695,6 @@ TEST_F(HlslGeneratorImplTest_Function,
void main() { void main() {
return; return;
} }
)"); )");
} }
@ -932,11 +715,11 @@ TEST_F(HlslGeneratorImplTest_Function,
EXPECT_EQ(result(), R"(static const int width = int(2); EXPECT_EQ(result(), R"(static const int width = int(2);
static const int height = int(3); static const int height = int(3);
static const int depth = int(4); static const int depth = int(4);
[numthreads(2, 3, 4)] [numthreads(2, 3, 4)]
void main() { void main() {
return; return;
} }
)"); )");
} }
@ -966,11 +749,11 @@ static const int height = WGSL_SPEC_CONSTANT_8;
#define WGSL_SPEC_CONSTANT_9 int(4) #define WGSL_SPEC_CONSTANT_9 int(4)
#endif #endif
static const int depth = WGSL_SPEC_CONSTANT_9; static const int depth = WGSL_SPEC_CONSTANT_9;
[numthreads(WGSL_SPEC_CONSTANT_7, WGSL_SPEC_CONSTANT_8, WGSL_SPEC_CONSTANT_9)] [numthreads(WGSL_SPEC_CONSTANT_7, WGSL_SPEC_CONSTANT_8, WGSL_SPEC_CONSTANT_9)]
void main() { void main() {
return; return;
} }
)"); )");
} }
@ -988,7 +771,6 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
EXPECT_EQ(result(), R"( void my_func(float a[5]) { EXPECT_EQ(result(), R"( void my_func(float a[5]) {
return; return;
} }
)"); )");
} }
@ -1052,8 +834,7 @@ TEST_F(HlslGeneratorImplTest_Function,
GeneratorImpl& gen = SanitizeAndBuild(); GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"( EXPECT_EQ(result(), R"(RWByteAddressBuffer data : register(u0, space0);
RWByteAddressBuffer data : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void a() { void a() {
@ -1066,7 +847,6 @@ void b() {
float v = asfloat(data.Load(0u)); float v = asfloat(data.Load(0u));
return; return;
} }
)"); )");
} }

View File

@ -502,7 +502,6 @@ void main() {
DeviceMemoryBarrierWithGroupSync(); DeviceMemoryBarrierWithGroupSync();
return; return;
} }
)"); )");
} }
@ -519,7 +518,6 @@ void main() {
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
return; return;
} }
)"); )");
} }
@ -543,7 +541,6 @@ void main() {
f(1, 2, 3); f(1, 2, 3);
return; return;
} }
)"); )");
} }

View File

@ -143,7 +143,6 @@ void test_function() {
float expr = str.mem; float expr = str.mem;
return; return;
} }
)"); )");
} }
@ -342,19 +341,17 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
RWByteAddressBuffer data : register(u0, space1);
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, float2x3 value) {
buffer.Store3((offset + 0u), asuint(value[0u])); buffer.Store3((offset + 0u), asuint(value[0u]));
buffer.Store3((offset + 16u), asuint(value[1u])); buffer.Store3((offset + 16u), asuint(value[1u]));
} }
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
tint_symbol_1(data, 16u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); tint_symbol_1(data, 16u, float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -383,14 +380,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
float x = asfloat(data.Load(52u)); float x = asfloat(data.Load(52u));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -417,14 +412,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
int x = asint(data.Load(12u)); int x = asint(data.Load(12u));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -452,14 +445,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
int x = asint(data.Load((4u + (4u * uint(((2 + 4) - 3)))))); int x = asint(data.Load((4u + (4u * uint(((2 + 4) - 3))))));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -484,14 +475,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
data.Store(12u, asuint(2)); data.Store(12u, asuint(2));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -527,14 +516,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
float3 x = asfloat(data.Load3(80u)); float3 x = asfloat(data.Load3(80u));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -573,14 +560,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
float2 x = asfloat(data.Load3(80u)).xy; float2 x = asfloat(data.Load3(80u)).xy;
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -619,14 +604,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
float x = asfloat(data.Load(84u)); float x = asfloat(data.Load(84u));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -665,14 +648,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
float x = asfloat(data.Load(84u)); float x = asfloat(data.Load(84u));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -707,14 +688,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_MultiLevel) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
data.Store3(80u, asuint(float3(1.0f, 2.0f, 3.0f))); data.Store3(80u, asuint(float3(1.0f, 2.0f, 3.0f)));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }
@ -753,14 +732,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto* expected = auto* expected =
R"( R"(RWByteAddressBuffer data : register(u0, space1);
RWByteAddressBuffer data : register(u0, space1);
void main() { void main() {
data.Store(84u, asuint(1.0f)); data.Store(84u, asuint(1.0f));
return; return;
} }
)"; )";
EXPECT_EQ(result(), expected); EXPECT_EQ(result(), expected);
} }

View File

@ -56,8 +56,7 @@ TEST_F(HlslSanitizerTest, ArrayLength_DEPRECATED) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto got = result(); auto got = result();
auto* expect = R"( auto* expect = R"(ByteAddressBuffer sb : register(t0, space1);
ByteAddressBuffer sb : register(t0, space1);
void main() { void main() {
uint tint_symbol_1 = 0u; uint tint_symbol_1 = 0u;
@ -66,7 +65,6 @@ void main() {
uint len = tint_symbol_2; uint len = tint_symbol_2;
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }
@ -94,8 +92,7 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto got = result(); auto got = result();
auto* expect = R"( auto* expect = R"(ByteAddressBuffer b : register(t1, space2);
ByteAddressBuffer b : register(t1, space2);
void a_func() { void a_func() {
uint tint_symbol_1 = 0u; uint tint_symbol_1 = 0u;
@ -104,7 +101,6 @@ void a_func() {
uint len = tint_symbol_2; uint len = tint_symbol_2;
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }
@ -136,8 +132,7 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto got = result(); auto got = result();
auto* expect = R"( auto* expect = R"(ByteAddressBuffer b : register(t1, space2);
ByteAddressBuffer b : register(t1, space2);
void a_func() { void a_func() {
uint tint_symbol_1 = 0u; uint tint_symbol_1 = 0u;
@ -146,7 +141,6 @@ void a_func() {
uint len = tint_symbol_2; uint len = tint_symbol_2;
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
@ -180,8 +174,7 @@ TEST_F(HlslSanitizerTest, Call_ArrayLength_ViaLets) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto got = result(); auto got = result();
auto* expect = R"( auto* expect = R"(ByteAddressBuffer b : register(t1, space2);
ByteAddressBuffer b : register(t1, space2);
void a_func() { void a_func() {
uint tint_symbol_1 = 0u; uint tint_symbol_1 = 0u;
@ -190,7 +183,6 @@ void a_func() {
uint len = tint_symbol_2; uint len = tint_symbol_2;
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
@ -219,7 +211,6 @@ TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) {
int pos = tint_symbol[3]; int pos = tint_symbol[3];
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }
@ -259,7 +250,6 @@ void main() {
float3 pos = tint_symbol.b; float3 pos = tint_symbol.b;
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }
@ -293,7 +283,6 @@ TEST_F(HlslSanitizerTest, InlinePtrLetsBasic) {
int x = v; int x = v;
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }
@ -337,7 +326,6 @@ TEST_F(HlslSanitizerTest, InlinePtrLetsComplexChain) {
float f = m[2][1]; float f = m[2][1];
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }
@ -386,7 +374,6 @@ void main() {
int r = x(v); int r = x(v);
return; return;
} }
)"; )";
EXPECT_EQ(expect, got); EXPECT_EQ(expect, got);
} }

View File

@ -30,7 +30,6 @@ TEST_F(HlslGeneratorImplTest, Generate) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"(void my_func() { EXPECT_EQ(result(), R"(void my_func() {
} }
)"); )");
} }

View File

@ -175,7 +175,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
auto* sem_s = program->TypeOf(s)->As<sem::Struct>(); auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
ASSERT_TRUE(gen.EmitStructType(out, sem_s, "S")) << gen.error(); ASSERT_TRUE(gen.EmitStructType(out, sem_s)) << gen.error();
EXPECT_EQ(result(), R"(struct S { EXPECT_EQ(result(), R"(struct S {
int a; int a;
float b; float b;
@ -199,7 +199,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl_OmittedIfStorageBuffer) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
auto* sem_s = program->TypeOf(s)->As<sem::Struct>(); auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
ASSERT_TRUE(gen.EmitStructType(out, sem_s, "S")) << gen.error(); ASSERT_TRUE(gen.EmitStructType(out, sem_s)) << gen.error();
EXPECT_EQ(result(), ""); EXPECT_EQ(result(), "");
} }
@ -264,26 +264,6 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct_NameCollision) {
)")); )"));
} }
// TODO(dsinclair): How to translate [[block]]
TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_WithDecoration) {
auto* s = Structure("S",
{
Member("a", ty.i32()),
Member("b", ty.f32()),
},
{create<ast::StructBlockDecoration>()});
Global("g", ty.Of(s), ast::StorageClass::kPrivate);
GeneratorImpl& gen = Build();
auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
ASSERT_TRUE(gen.EmitStructType(out, sem_s, "B")) << gen.error();
EXPECT_EQ(result(), R"(struct B {
int a;
float b;
})");
}
TEST_F(HlslGeneratorImplTest_Type, EmitType_U32) { TEST_F(HlslGeneratorImplTest_Type, EmitType_U32) {
auto* u32 = create<sem::U32>(); auto* u32 = create<sem::U32>();

View File

@ -532,7 +532,6 @@ tint_unittests_source_set("tint_unittests_msl_writer_src") {
"../src/writer/msl/generator_impl_constructor_test.cc", "../src/writer/msl/generator_impl_constructor_test.cc",
"../src/writer/msl/generator_impl_continue_test.cc", "../src/writer/msl/generator_impl_continue_test.cc",
"../src/writer/msl/generator_impl_discard_test.cc", "../src/writer/msl/generator_impl_discard_test.cc",
"../src/writer/msl/generator_impl_function_entry_point_data_test.cc",
"../src/writer/msl/generator_impl_function_test.cc", "../src/writer/msl/generator_impl_function_test.cc",
"../src/writer/msl/generator_impl_identifier_test.cc", "../src/writer/msl/generator_impl_identifier_test.cc",
"../src/writer/msl/generator_impl_if_test.cc", "../src/writer/msl/generator_impl_if_test.cc",
@ -572,7 +571,6 @@ tint_unittests_source_set("tint_unittests_hlsl_writer_src") {
"../src/writer/hlsl/generator_impl_constructor_test.cc", "../src/writer/hlsl/generator_impl_constructor_test.cc",
"../src/writer/hlsl/generator_impl_continue_test.cc", "../src/writer/hlsl/generator_impl_continue_test.cc",
"../src/writer/hlsl/generator_impl_discard_test.cc", "../src/writer/hlsl/generator_impl_discard_test.cc",
"../src/writer/hlsl/generator_impl_function_entry_point_data_test.cc",
"../src/writer/hlsl/generator_impl_function_test.cc", "../src/writer/hlsl/generator_impl_function_test.cc",
"../src/writer/hlsl/generator_impl_identifier_test.cc", "../src/writer/hlsl/generator_impl_identifier_test.cc",
"../src/writer/hlsl/generator_impl_if_test.cc", "../src/writer/hlsl/generator_impl_if_test.cc",

View File

@ -3,4 +3,3 @@ void main() {
const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y; const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
return; return;
} }

View File

@ -5,4 +5,3 @@ void main() {
const float f = v[1]; const float f = v[1];
return; return;
} }

View File

@ -5,4 +5,3 @@ void main() {
const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y); const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
return; return;
} }

View File

@ -6,4 +6,3 @@ void main() {
const float3 swizzle3 = v.xzy; const float3 swizzle3 = v.xzy;
return; return;
} }

View File

@ -5,4 +5,3 @@ void main() {
const float x_16 = x_15.y; const float x_16 = x_15.y;
return; return;
} }

View File

@ -5,4 +5,3 @@ void main() {
const float f = v[1]; const float f = v[1];
return; return;
} }

View File

@ -8,4 +8,3 @@ void main() {
const float3 x_19 = float3(x_18.x, x_18.z, x_18.y); const float3 x_19 = float3(x_18.x, x_18.z, x_18.y);
return; return;
} }

View File

@ -6,4 +6,3 @@ void main() {
const float3 swizzle3 = v.xzy; const float3 swizzle3 = v.xzy;
return; return;
} }

View File

@ -1 +1,61 @@
SKIP: crbug.com/tint/845 SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int arr[4];
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
const int tint_symbol_3[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
return tint_symbol_3;
}
static int src_private[4];
groupshared int src_workgroup[4];
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
int[4] ret_arr() {
const int tint_symbol_4[4] = {0, 0, 0, 0};
return tint_symbol_4;
}
S ret_struct_arr() {
const S tint_symbol_5 = {{0, 0, 0, 0}};
return tint_symbol_5;
}
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0};
int tint_symbol[4] = {0, 0, 0, 0};
const int tint_symbol_6[4] = {1, 2, 3, 3};
tint_symbol = tint_symbol_6;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int src_let[4] = {0, 0, 0, 0};
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u);
int dst_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
dst_nested = src_nested;
}
tint_bTL3Zd:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
~~~ ^
[4]
tint_bTL3Zd:20:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] ret_arr() {
~~~ ^
[4]

View File

@ -1 +1,61 @@
SKIP: crbug.com/tint/845 SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int arr[4];
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
const int tint_symbol_3[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
return tint_symbol_3;
}
static int src_private[4];
groupshared int src_workgroup[4];
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
static int tint_symbol[4];
static int dst_nested[4][3][2];
int[4] ret_arr() {
const int tint_symbol_4[4] = {0, 0, 0, 0};
return tint_symbol_4;
}
S ret_struct_arr() {
const S tint_symbol_5 = {{0, 0, 0, 0}};
return tint_symbol_5;
}
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0};
const int tint_symbol_6[4] = {1, 2, 3, 3};
tint_symbol = tint_symbol_6;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int src_let[4] = {0, 0, 0, 0};
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u);
int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
dst_nested = src_nested;
}
tint_Sca05u:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
~~~ ^
[4]
tint_Sca05u:22:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] ret_arr() {
~~~ ^
[4]

View File

@ -1 +1,83 @@
SKIP: crbug.com/tint/845 SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int arr[4];
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
const int tint_symbol_9[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
return tint_symbol_9;
}
void tint_symbol_4(RWByteAddressBuffer buffer, uint offset, int value[4]) {
buffer.Store((offset + 0u), asuint(value[0u]));
buffer.Store((offset + 16u), asuint(value[1u]));
buffer.Store((offset + 32u), asuint(value[2u]));
buffer.Store((offset + 48u), asuint(value[3u]));
}
void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, int value[2]) {
buffer.Store((offset + 0u), asuint(value[0u]));
buffer.Store((offset + 4u), asuint(value[1u]));
}
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
tint_symbol_6(buffer, (offset + 0u), value[0u]);
tint_symbol_6(buffer, (offset + 8u), value[1u]);
tint_symbol_6(buffer, (offset + 16u), value[2u]);
}
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
tint_symbol_7(buffer, (offset + 0u), value[0u]);
tint_symbol_7(buffer, (offset + 24u), value[1u]);
tint_symbol_7(buffer, (offset + 48u), value[2u]);
tint_symbol_7(buffer, (offset + 72u), value[3u]);
}
static int src_private[4];
groupshared int src_workgroup[4];
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
RWByteAddressBuffer tint_symbol : register(u2, space0);
RWByteAddressBuffer dst_nested : register(u3, space0);
int[4] ret_arr() {
const int tint_symbol_10[4] = {0, 0, 0, 0};
return tint_symbol_10;
}
S ret_struct_arr() {
const S tint_symbol_11 = {{0, 0, 0, 0}};
return tint_symbol_11;
}
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0};
const int tint_symbol_12[4] = {1, 2, 3, 3};
tint_symbol_4(tint_symbol, 0u, tint_symbol_12);
tint_symbol_4(tint_symbol, 0u, src_param);
tint_symbol_4(tint_symbol, 0u, ret_arr());
const int src_let[4] = {0, 0, 0, 0};
tint_symbol_4(tint_symbol, 0u, src_let);
tint_symbol_4(tint_symbol, 0u, src_function);
tint_symbol_4(tint_symbol, 0u, src_private);
tint_symbol_4(tint_symbol, 0u, src_workgroup);
tint_symbol_4(tint_symbol, 0u, ret_struct_arr().arr);
tint_symbol_4(tint_symbol, 0u, src_uniform.arr);
tint_symbol_4(tint_symbol, 0u, tint_symbol_2(src_storage, 0u));
int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
tint_symbol_8(dst_nested, 0u, src_nested);
}
tint_4gsbi1:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
~~~ ^
[4]
tint_4gsbi1:44:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] ret_arr() {
~~~ ^
[4]

View File

@ -1,3 +1,8 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S { struct S {
int arr[4]; int arr[4];
}; };
@ -13,9 +18,3 @@ void foo() {
dst_struct.arr = src; dst_struct.arr = src;
dst_array[0] = src; dst_array[0] = src;
} }
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}

View File

@ -1 +1,61 @@
SKIP: crbug.com/tint/845 SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int arr[4];
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
const int tint_symbol_3[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
return tint_symbol_3;
}
static int src_private[4];
groupshared int src_workgroup[4];
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
groupshared int tint_symbol[4];
groupshared int dst_nested[4][3][2];
int[4] ret_arr() {
const int tint_symbol_4[4] = {0, 0, 0, 0};
return tint_symbol_4;
}
S ret_struct_arr() {
const S tint_symbol_5 = {{0, 0, 0, 0}};
return tint_symbol_5;
}
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0};
const int tint_symbol_6[4] = {1, 2, 3, 3};
tint_symbol = tint_symbol_6;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int src_let[4] = {0, 0, 0, 0};
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u);
int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
dst_nested = src_nested;
}
tint_atjMoG:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
~~~ ^
[4]
tint_atjMoG:22:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
int[4] ret_arr() {
~~~ ^
[4]

View File

@ -20,4 +20,3 @@ void main() {
const float v3 = f3(a3); const float v3 = f3(a3);
return; return;
} }

View File

@ -1 +1,38 @@
SKIP: crbug.com/tint/845 SKIP: FAILED
Validation Failure:
float[4] f1() {
const float tint_symbol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
return tint_symbol;
}
float[3][4] f2() {
const float tint_symbol_1[3][4] = {f1(), f1(), f1()};
return tint_symbol_1;
}
float[2][3][4] f3() {
const float tint_symbol_2[2][3][4] = {f2(), f2()};
return tint_symbol_2;
}
[numthreads(1, 1, 1)]
void main() {
const float a1[4] = f1();
const float a2[3][4] = f2();
const float a3[2][3][4] = f3();
return;
}
tint_gQgfKR:1:14: error: brackets are not allowed here; to declare an array, place the brackets after the name
float[4] f1() {
~~~ ^
[4]
tint_gQgfKR:5:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
float[3][4] f2() {
~~~~~~ ^
[3][4]
tint_gQgfKR:9:20: error: brackets are not allowed here; to declare an array, place the brackets after the name
float[2][3][4] f3() {
~~~~~~~~~ ^
[2][3][4]

View File

@ -35,4 +35,3 @@ void main() {
const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1]; const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1];
return; return;
} }

View File

@ -1,4 +1,3 @@
RWByteAddressBuffer b : register(u0, space0); RWByteAddressBuffer b : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -24,4 +23,3 @@ void main() {
} }
return; return;
} }

View File

@ -3,4 +3,3 @@ void main() {
float3 negative_light = -(light); float3 negative_light = -(light);
return; return;
} }

View File

@ -2,9 +2,9 @@ bug/tint/294.wgsl:8:24 warning: use of deprecated language feature: declare acce
[[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights; [[set(0), binding(1)]] var<storage> lights : [[access(read)]] Lights;
^^^ ^^^
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
ByteAddressBuffer lights : register(t1, space0);

View File

@ -9,6 +9,10 @@ struct vertexUniformBuffer1 {
struct vertexUniformBuffer2 { struct vertexUniformBuffer2 {
float2x2 transform2; float2x2 transform2;
}; };
ConstantBuffer<vertexUniformBuffer1> x_20 : register(b0, space0);
ConstantBuffer<vertexUniformBuffer2> x_26 : register(b0, space1);
struct tint_symbol_1 { struct tint_symbol_1 {
int gl_VertexIndex : SV_VertexID; int gl_VertexIndex : SV_VertexID;
}; };
@ -16,9 +20,6 @@ struct tint_symbol_2 {
float4 value : SV_Position; float4 value : SV_Position;
}; };
ConstantBuffer<vertexUniformBuffer1> x_20 : register(b0, space0);
ConstantBuffer<vertexUniformBuffer2> x_26 : register(b0, space1);
tint_symbol_2 main(tint_symbol_1 tint_symbol) { tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const int gl_VertexIndex = tint_symbol.gl_VertexIndex; const int gl_VertexIndex = tint_symbol.gl_VertexIndex;
float2 indexable[3] = {float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)}; float2 indexable[3] = {float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)};
@ -33,7 +34,6 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
return tint_symbol_4; return tint_symbol_4;
} }
warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments. warning: DXIL.dll not found. Resulting DXIL will not be signed for use in release environments.
error: validation errors error: validation errors

View File

@ -12,4 +12,3 @@ void main() {
Dst[int2(0, 0)] = x_27; Dst[int2(0, 0)] = x_27;
return; return;
} }

View File

@ -1,5 +1,3 @@
SKIP: FAILED
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0

View File

@ -20,4 +20,3 @@ void main() {
Dst[int2(0, 0)] = x_27.xxxx; Dst[int2(0, 0)] = x_27.xxxx;
return; return;
} }

View File

@ -1,5 +1,3 @@
SKIP: FAILED
bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures bug/tint/453.wgsl:1:79 warning: use of deprecated language feature: access control is expected as last parameter of storage textures
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>; [[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
^ ^

View File

@ -1,4 +1,3 @@
RWByteAddressBuffer buf : register(u0, space0); RWByteAddressBuffer buf : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -6,4 +5,3 @@ void main() {
buf.Store(0u, asuint(12)); buf.Store(0u, asuint(12));
return; return;
} }

View File

@ -3,15 +3,15 @@ struct Uniforms {
uint2 bShape; uint2 bShape;
uint2 outShape; uint2 outShape;
}; };
struct tint_symbol_1 {
uint3 global_id : SV_DispatchThreadID;
};
ConstantBuffer<Uniforms> uniforms : register(b3, space0);
ByteAddressBuffer firstMatrix : register(t0, space0); ByteAddressBuffer firstMatrix : register(t0, space0);
ByteAddressBuffer secondMatrix : register(t1, space0); ByteAddressBuffer secondMatrix : register(t1, space0);
RWByteAddressBuffer resultMatrix : register(u2, space0); RWByteAddressBuffer resultMatrix : register(u2, space0);
ConstantBuffer<Uniforms> uniforms : register(b3, space0);
struct tint_symbol_1 {
uint3 global_id : SV_DispatchThreadID;
};
[numthreads(2, 2, 1)] [numthreads(2, 2, 1)]
void main(tint_symbol_1 tint_symbol) { void main(tint_symbol_1 tint_symbol) {
@ -38,4 +38,3 @@ void main(tint_symbol_1 tint_symbol) {
resultMatrix.Store((4u * index), asuint(result)); resultMatrix.Store((4u * index), asuint(result));
return; return;
} }

File diff suppressed because it is too large Load Diff

View File

@ -9,13 +9,15 @@ bug/tint/757.wgsl:10:5 warning: use of deprecated language feature: [[offset]] h
struct Constants { struct Constants {
int level; int level;
}; };
struct tint_symbol_1 {
uint3 GlobalInvocationID : SV_DispatchThreadID; ConstantBuffer<Constants> constants : register(b0, space0);
}; Texture2DArray<float4> myTexture : register(t1, space0);
RWByteAddressBuffer result : register(u3, space0); RWByteAddressBuffer result : register(u3, space0);
Texture2DArray<float4> myTexture : register(t1, space0); struct tint_symbol_1 {
uint3 GlobalInvocationID : SV_DispatchThreadID;
};
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main(tint_symbol_1 tint_symbol) { void main(tint_symbol_1 tint_symbol) {
@ -37,4 +39,3 @@ void main(tint_symbol_1 tint_symbol) {
} }
return; return;
} }

View File

@ -1,11 +1,10 @@
void f() {
const float4x4 m = float4x4(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f));
const float4 v1 = m[0];
const float a = v1[0];
}
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
void f() {
const float4x4 m = float4x4(float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f));
const float4 v1 = m[0];
const float a = v1[0];
}

View File

@ -1,12 +1,10 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void foo() { void foo() {
int tint_symbol[2] = {0, 0}; int tint_symbol[2] = {0, 0};
int implict[2] = {0, 0}; int implict[2] = {0, 0};
implict = tint_symbol; implict = tint_symbol;
} }
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}

View File

@ -23,4 +23,3 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const tint_symbol_2 tint_symbol_3 = {output.color, output.Position}; const tint_symbol_2 tint_symbol_3 = {output.color, output.Position};
return tint_symbol_3; return tint_symbol_3;
} }

View File

@ -1,12 +1,11 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() { void f() {
int i = 0; int i = 0;
int j = 0; int j = 0;
const float2x2 m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f)); const float2x2 m = float2x2(float2(1.0f, 2.0f), float2(3.0f, 4.0f));
const float f = m[i][j]; const float f = m[i][j];
} }
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}

View File

@ -2,19 +2,17 @@ bug/tint/827.wgsl:8:26 warning: use of deprecated language feature: declare acce
[[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result; [[group(0), binding(1)]] var<storage> result : [[access(read_write)]] Result;
^^^ ^^^
static const uint width = 128u;
Texture2D tex : register(t0, space0);
RWByteAddressBuffer result : register(u1, space0);
struct tint_symbol_1 { struct tint_symbol_1 {
uint3 GlobalInvocationId : SV_DispatchThreadID; uint3 GlobalInvocationId : SV_DispatchThreadID;
}; };
static const uint width = 128u;
RWByteAddressBuffer result : register(u1, space0);
Texture2D tex : register(t0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main(tint_symbol_1 tint_symbol) { void main(tint_symbol_1 tint_symbol) {
const uint3 GlobalInvocationId = tint_symbol.GlobalInvocationId; const uint3 GlobalInvocationId = tint_symbol.GlobalInvocationId;
result.Store((4u * ((GlobalInvocationId.y * width) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0), 0))); result.Store((4u * ((GlobalInvocationId.y * width) + GlobalInvocationId.x)), asuint(tex.Load(int3(int(GlobalInvocationId.x), int(GlobalInvocationId.y), 0), 0)));
return; return;
} }

View File

@ -2,7 +2,6 @@ deprecated/access_deco/storage_buffer.wgsl:7:26 warning: use of deprecated langu
[[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB; [[group(0), binding(0)]] var<storage> sb : [[access(read_write)]] SB;
^^^ ^^^
RWByteAddressBuffer sb : register(u0, space0); RWByteAddressBuffer sb : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -10,4 +9,3 @@ void main() {
float x = asfloat(sb.Load(0u)); float x = asfloat(sb.Load(0u));
return; return;
} }

View File

@ -11,4 +11,3 @@ void main() {
int2 x = tint_tmp; int2 x = tint_tmp;
return; return;
} }

View File

@ -1,7 +1,3 @@
struct tint_symbol {
float4 value : SV_Target0;
};
void bitwise_i32() { void bitwise_i32() {
int s1 = 0; int s1 = 0;
int s2 = 0; int s2 = 0;
@ -103,8 +99,11 @@ void matrix_matrix_f32() {
m44 = mul(m43, m34); m44 = mul(m43, m34);
} }
struct tint_symbol {
float4 value : SV_Target0;
};
tint_symbol main() { tint_symbol main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }

View File

@ -1,4 +1,3 @@
ByteAddressBuffer G : register(t0, space0); ByteAddressBuffer G : register(t0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -9,4 +8,3 @@ void main() {
const uint l1 = tint_symbol_2; const uint l1 = tint_symbol_2;
return; return;
} }

View File

@ -1,4 +1,3 @@
ByteAddressBuffer G : register(t0, space0); ByteAddressBuffer G : register(t0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -10,4 +9,3 @@ void main() {
const uint l2 = tint_symbol_2; const uint l2 = tint_symbol_2;
return; return;
} }

View File

@ -1,4 +1,3 @@
ByteAddressBuffer G : register(t0, space0); ByteAddressBuffer G : register(t0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -9,4 +8,3 @@ void main() {
const uint l1 = tint_symbol_2; const uint l1 = tint_symbol_2;
return; return;
} }

View File

@ -1,4 +1,3 @@
ByteAddressBuffer G : register(t0, space0); ByteAddressBuffer G : register(t0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -9,4 +8,3 @@ void main() {
const uint l1 = tint_symbol_2; const uint l1 = tint_symbol_2;
return; return;
} }

View File

@ -1,4 +1,3 @@
ByteAddressBuffer G : register(t0, space0); ByteAddressBuffer G : register(t0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -9,4 +8,3 @@ void main() {
const uint l1 = tint_symbol_2; const uint l1 = tint_symbol_2;
return; return;
} }

View File

@ -7,4 +7,3 @@ void main() {
const float significand = tint_tmp_1; const float significand = tint_tmp_1;
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_002533() { void abs_002533() {
float4 res = abs(float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = abs(float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_002533(); abs_002533();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_002533(); abs_002533();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_005174() { void abs_005174() {
float3 res = abs(float3(0.0f, 0.0f, 0.0f)); float3 res = abs(float3(0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_005174(); abs_005174();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_005174(); abs_005174();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_1ce782() { void abs_1ce782() {
uint4 res = abs(uint4(0u, 0u, 0u, 0u)); uint4 res = abs(uint4(0u, 0u, 0u, 0u));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_1ce782(); abs_1ce782();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_1ce782(); abs_1ce782();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_1e9d53() { void abs_1e9d53() {
float2 res = abs(float2(0.0f, 0.0f)); float2 res = abs(float2(0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_1e9d53(); abs_1e9d53();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_1e9d53(); abs_1e9d53();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_467cd1() { void abs_467cd1() {
uint res = abs(1u); uint res = abs(1u);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_467cd1(); abs_467cd1();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_467cd1(); abs_467cd1();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_4ad288() { void abs_4ad288() {
int res = abs(1); int res = abs(1);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_4ad288(); abs_4ad288();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_4ad288(); abs_4ad288();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_5ad50a() { void abs_5ad50a() {
int3 res = abs(int3(0, 0, 0)); int3 res = abs(int3(0, 0, 0));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_5ad50a(); abs_5ad50a();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_5ad50a(); abs_5ad50a();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_7326de() { void abs_7326de() {
uint3 res = abs(uint3(0u, 0u, 0u)); uint3 res = abs(uint3(0u, 0u, 0u));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_7326de(); abs_7326de();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_7326de(); abs_7326de();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_7f28e6() { void abs_7f28e6() {
uint2 res = abs(uint2(0u, 0u)); uint2 res = abs(uint2(0u, 0u));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_7f28e6(); abs_7f28e6();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_7f28e6(); abs_7f28e6();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_7faa9e() { void abs_7faa9e() {
int2 res = abs(int2(0, 0)); int2 res = abs(int2(0, 0));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_7faa9e(); abs_7faa9e();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_7faa9e(); abs_7faa9e();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_9c80a6() { void abs_9c80a6() {
int4 res = abs(int4(0, 0, 0, 0)); int4 res = abs(int4(0, 0, 0, 0));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_9c80a6(); abs_9c80a6();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_9c80a6(); abs_9c80a6();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void abs_b96037() { void abs_b96037() {
float res = abs(1.0f); float res = abs(1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
abs_b96037(); abs_b96037();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
abs_b96037(); abs_b96037();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void acos_489247() { void acos_489247() {
float res = acos(1.0f); float res = acos(1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
acos_489247(); acos_489247();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
acos_489247(); acos_489247();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void acos_8e2acf() { void acos_8e2acf() {
float4 res = acos(float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = acos(float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
acos_8e2acf(); acos_8e2acf();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
acos_8e2acf(); acos_8e2acf();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void acos_a610c4() { void acos_a610c4() {
float3 res = acos(float3(0.0f, 0.0f, 0.0f)); float3 res = acos(float3(0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
acos_a610c4(); acos_a610c4();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
acos_a610c4(); acos_a610c4();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void acos_dfc915() { void acos_dfc915() {
float2 res = acos(float2(0.0f, 0.0f)); float2 res = acos(float2(0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
acos_dfc915(); acos_dfc915();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
acos_dfc915(); acos_dfc915();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void all_986c7b() { void all_986c7b() {
bool res = all(bool4(false, false, false, false)); bool res = all(bool4(false, false, false, false));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
all_986c7b(); all_986c7b();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
all_986c7b(); all_986c7b();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void all_bd2dba() { void all_bd2dba() {
bool res = all(bool3(false, false, false)); bool res = all(bool3(false, false, false));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
all_bd2dba(); all_bd2dba();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
all_bd2dba(); all_bd2dba();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void all_f46790() { void all_f46790() {
bool res = all(bool2(false, false)); bool res = all(bool2(false, false));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
all_f46790(); all_f46790();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
all_f46790(); all_f46790();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void any_083428() { void any_083428() {
bool res = any(bool4(false, false, false, false)); bool res = any(bool4(false, false, false, false));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
any_083428(); any_083428();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
any_083428(); any_083428();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void any_0e3e58() { void any_0e3e58() {
bool res = any(bool2(false, false)); bool res = any(bool2(false, false));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
any_0e3e58(); any_0e3e58();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
any_0e3e58(); any_0e3e58();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void any_e755c1() { void any_e755c1() {
bool res = any(bool3(false, false, false)); bool res = any(bool3(false, false, false));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
any_e755c1(); any_e755c1();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
any_e755c1(); any_e755c1();
return; return;
} }

View File

@ -2,10 +2,6 @@ intrinsics/gen/arrayLength/647a40.wgsl:31:18 warning: use of deprecated intrinsi
var res: u32 = arrayLength(sb.arg_0); var res: u32 = arrayLength(sb.arg_0);
^^^^^^^^^^^ ^^^^^^^^^^^
struct tint_symbol {
float4 value : SV_Position;
};
ByteAddressBuffer sb : register(t0, space0); ByteAddressBuffer sb : register(t0, space0);
void arrayLength_647a40() { void arrayLength_647a40() {
@ -15,6 +11,10 @@ void arrayLength_647a40() {
uint res = tint_symbol_3; uint res = tint_symbol_3;
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
arrayLength_647a40(); arrayLength_647a40();
const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -31,4 +31,3 @@ void compute_main() {
arrayLength_647a40(); arrayLength_647a40();
return; return;
} }

View File

@ -2,10 +2,6 @@ intrinsics/gen/arrayLength/721c9d.wgsl:31:18 warning: use of deprecated intrinsi
var res: u32 = arrayLength(sb.arg_0); var res: u32 = arrayLength(sb.arg_0);
^^^^^^^^^^^ ^^^^^^^^^^^
struct tint_symbol {
float4 value : SV_Position;
};
ByteAddressBuffer sb : register(t0, space0); ByteAddressBuffer sb : register(t0, space0);
void arrayLength_721c9d() { void arrayLength_721c9d() {
@ -15,6 +11,10 @@ void arrayLength_721c9d() {
uint res = tint_symbol_3; uint res = tint_symbol_3;
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
arrayLength_721c9d(); arrayLength_721c9d();
const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -31,4 +31,3 @@ void compute_main() {
arrayLength_721c9d(); arrayLength_721c9d();
return; return;
} }

View File

@ -2,10 +2,6 @@ intrinsics/gen/arrayLength/b083be.wgsl:31:18 warning: use of deprecated intrinsi
var res: u32 = arrayLength(sb.arg_0); var res: u32 = arrayLength(sb.arg_0);
^^^^^^^^^^^ ^^^^^^^^^^^
struct tint_symbol {
float4 value : SV_Position;
};
ByteAddressBuffer sb : register(t0, space0); ByteAddressBuffer sb : register(t0, space0);
void arrayLength_b083be() { void arrayLength_b083be() {
@ -15,6 +11,10 @@ void arrayLength_b083be() {
uint res = tint_symbol_3; uint res = tint_symbol_3;
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
arrayLength_b083be(); arrayLength_b083be();
const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_4 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -31,4 +31,3 @@ void compute_main() {
arrayLength_b083be(); arrayLength_b083be();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void asin_064953() { void asin_064953() {
float4 res = asin(float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = asin(float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
asin_064953(); asin_064953();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
asin_064953(); asin_064953();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void asin_7b6a44() { void asin_7b6a44() {
float2 res = asin(float2(0.0f, 0.0f)); float2 res = asin(float2(0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
asin_7b6a44(); asin_7b6a44();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
asin_7b6a44(); asin_7b6a44();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void asin_8cd9c9() { void asin_8cd9c9() {
float3 res = asin(float3(0.0f, 0.0f, 0.0f)); float3 res = asin(float3(0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
asin_8cd9c9(); asin_8cd9c9();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
asin_8cd9c9(); asin_8cd9c9();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void asin_c0c272() { void asin_c0c272() {
float res = asin(1.0f); float res = asin(1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
asin_c0c272(); asin_c0c272();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
asin_c0c272(); asin_c0c272();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void atan_02979a() { void atan_02979a() {
float res = atan(1.0f); float res = atan(1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
atan_02979a(); atan_02979a();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
atan_02979a(); atan_02979a();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void atan_331e6d() { void atan_331e6d() {
float3 res = atan(float3(0.0f, 0.0f, 0.0f)); float3 res = atan(float3(0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
atan_331e6d(); atan_331e6d();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
atan_331e6d(); atan_331e6d();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void atan_a8b696() { void atan_a8b696() {
float4 res = atan(float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = atan(float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
atan_a8b696(); atan_a8b696();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
atan_a8b696(); atan_a8b696();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void atan_ad96e4() { void atan_ad96e4() {
float2 res = atan(float2(0.0f, 0.0f)); float2 res = atan(float2(0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
atan_ad96e4(); atan_ad96e4();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
atan_ad96e4(); atan_ad96e4();
return; return;
} }

View File

@ -7,25 +7,30 @@ void atan2_57fb13() {
float2 res = atan2(float2(0.0f, 0.0f), float2(0.0f, 0.0f)); float2 res = atan2(float2(0.0f, 0.0f), float2(0.0f, 0.0f));
} }
void vertex_main() { struct tint_symbol {
atan2_57fb13(); float4 value : SV_Position;
return; };
}
tint_symbol vertex_main() {
atan2_57fb13();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() { void fragment_main() {
atan2_57fb13(); atan2_57fb13();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
atan2_57fb13(); atan2_57fb13();
return; return;
} }
Internal Compiler error: cast<X>() argument of incompatible type!
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed. Internal Compiler error: cast<X>() argument of incompatible type!
Internal Compiler error: cast<X>() argument of incompatible type!
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void atan2_96057c() { void atan2_96057c() {
float res = atan2(1.0f, 1.0f); float res = atan2(1.0f, 1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
atan2_96057c(); atan2_96057c();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
atan2_96057c(); atan2_96057c();
return; return;
} }

View File

@ -7,25 +7,30 @@ void atan2_a70d0d() {
float3 res = atan2(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f)); float3 res = atan2(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
} }
void vertex_main() { struct tint_symbol {
atan2_a70d0d(); float4 value : SV_Position;
return; };
}
tint_symbol vertex_main() {
atan2_a70d0d();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() { void fragment_main() {
atan2_a70d0d(); atan2_a70d0d();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
atan2_a70d0d(); atan2_a70d0d();
return; return;
} }
Internal Compiler error: cast<X>() argument of incompatible type!
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed. Internal Compiler error: cast<X>() argument of incompatible type!
Internal Compiler error: cast<X>() argument of incompatible type!
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

View File

@ -7,25 +7,30 @@ void atan2_ae713e() {
float4 res = atan2(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = atan2(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
void vertex_main() { struct tint_symbol {
atan2_ae713e(); float4 value : SV_Position;
return; };
}
tint_symbol vertex_main() {
atan2_ae713e();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() { void fragment_main() {
atan2_ae713e(); atan2_ae713e();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
atan2_ae713e(); atan2_ae713e();
return; return;
} }
Internal Compiler error: cast<X>() argument of incompatible type!
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed. Internal Compiler error: cast<X>() argument of incompatible type!
Internal Compiler error: cast<X>() argument of incompatible type!
dxc: /build/directxshadercompiler-1.4.0.2274-413-1lunarg18.04/include/llvm/Support/Casting.h:238: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::ConstantFP; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::ConstantFP*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void ceil_34064b() { void ceil_34064b() {
float3 res = ceil(float3(0.0f, 0.0f, 0.0f)); float3 res = ceil(float3(0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
ceil_34064b(); ceil_34064b();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
ceil_34064b(); ceil_34064b();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void ceil_678655() { void ceil_678655() {
float res = ceil(1.0f); float res = ceil(1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
ceil_678655(); ceil_678655();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
ceil_678655(); ceil_678655();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void ceil_96f597() { void ceil_96f597() {
float2 res = ceil(float2(0.0f, 0.0f)); float2 res = ceil(float2(0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
ceil_96f597(); ceil_96f597();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
ceil_96f597(); ceil_96f597();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void ceil_b74c16() { void ceil_b74c16() {
float4 res = ceil(float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = ceil(float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
ceil_b74c16(); ceil_b74c16();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
ceil_b74c16(); ceil_b74c16();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void clamp_0acf8f() { void clamp_0acf8f() {
float2 res = clamp(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)); float2 res = clamp(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
clamp_0acf8f(); clamp_0acf8f();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
clamp_0acf8f(); clamp_0acf8f();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void clamp_1a32e3() { void clamp_1a32e3() {
int4 res = clamp(int4(0, 0, 0, 0), int4(0, 0, 0, 0), int4(0, 0, 0, 0)); int4 res = clamp(int4(0, 0, 0, 0), int4(0, 0, 0, 0), int4(0, 0, 0, 0));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
clamp_1a32e3(); clamp_1a32e3();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
clamp_1a32e3(); clamp_1a32e3();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void clamp_2bd567() { void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f); float res = clamp(1.0f, 1.0f, 1.0f);
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
clamp_2bd567(); clamp_2bd567();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
clamp_2bd567(); clamp_2bd567();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void clamp_2bde41() { void clamp_2bde41() {
float4 res = clamp(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)); float4 res = clamp(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
clamp_2bde41(); clamp_2bde41();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
clamp_2bde41(); clamp_2bde41();
return; return;
} }

View File

@ -1,11 +1,11 @@
struct tint_symbol {
float4 value : SV_Position;
};
void clamp_548fc7() { void clamp_548fc7() {
uint3 res = clamp(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u), uint3(0u, 0u, 0u)); uint3 res = clamp(uint3(0u, 0u, 0u), uint3(0u, 0u, 0u), uint3(0u, 0u, 0u));
} }
struct tint_symbol {
float4 value : SV_Position;
};
tint_symbol vertex_main() { tint_symbol vertex_main() {
clamp_548fc7(); clamp_548fc7();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
@ -22,4 +22,3 @@ void compute_main() {
clamp_548fc7(); clamp_548fc7();
return; return;
} }

Some files were not shown because too many files have changed in this diff Show More