Convert GLSL Generator over to utils::StringStream.

This CL switches the GLSL Generator to use utils::StringStream. The line
writer is converted internally as well, although it converts to
`std::ostream` for now. This caused a couple of the MSL, HLSL and GLSL
tests to generate slightly fewer decimal points in a couple tests.

Bug: tint:1686
Change-Id: I9ec8c1a5ef49679fc1c9a9aece86ab3390e103fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121880
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
dan sinclair 2023-02-28 14:41:45 +00:00 committed by Dawn LUCI CQ
parent 98826ef4de
commit dba03d30fb
85 changed files with 362 additions and 330 deletions

View File

@ -96,6 +96,10 @@ class StringStream {
/// @returns the string contents of the stream /// @returns the string contents of the stream
std::string str() const { return sstream_.str(); } std::string str() const { return sstream_.str(); }
/// [DEPRECATED] This should not be called.
/// @returns the underlying stream
std::ostream& stream() { return sstream_; }
private: private:
std::stringstream sstream_; std::stringstream sstream_;
}; };

View File

@ -75,6 +75,7 @@
#include "src/tint/utils/map.h" #include "src/tint/utils/map.h"
#include "src/tint/utils/scoped_assignment.h" #include "src/tint/utils/scoped_assignment.h"
#include "src/tint/utils/string.h" #include "src/tint/utils/string.h"
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/append_vector.h" #include "src/tint/writer/append_vector.h"
#include "src/tint/writer/float_to_string.h" #include "src/tint/writer/float_to_string.h"
#include "src/tint/writer/generate_external_texture_bindings.h" #include "src/tint/writer/generate_external_texture_bindings.h"
@ -111,7 +112,7 @@ bool last_is_break(const ast::BlockStatement* stmts) {
return IsAnyOf<ast::BreakStatement>(stmts->Last()); return IsAnyOf<ast::BreakStatement>(stmts->Last());
} }
void PrintF32(std::ostream& out, float value) { void PrintF32(utils::StringStream& out, float value) {
if (std::isinf(value)) { if (std::isinf(value)) {
out << "0.0f " << (value >= 0 ? "/* inf */" : "/* -inf */"); out << "0.0f " << (value >= 0 ? "/* inf */" : "/* -inf */");
} else if (std::isnan(value)) { } else if (std::isnan(value)) {
@ -121,7 +122,7 @@ void PrintF32(std::ostream& out, float value) {
} }
} }
void PrintF16(std::ostream& out, float value) { void PrintF16(utils::StringStream& out, float value) {
if (std::isinf(value)) { if (std::isinf(value)) {
out << "0.0hf " << (value >= 0 ? "/* inf */" : "/* -inf */"); out << "0.0hf " << (value >= 0 ? "/* inf */" : "/* -inf */");
} else if (std::isnan(value)) { } else if (std::isnan(value)) {
@ -333,7 +334,8 @@ bool GeneratorImpl::RecordExtension(const ast::Enable* ext) {
return true; return true;
} }
bool GeneratorImpl::EmitIndexAccessor(std::ostream& out, const ast::IndexAccessorExpression* expr) { bool GeneratorImpl::EmitIndexAccessor(utils::StringStream& out,
const ast::IndexAccessorExpression* expr) {
if (!EmitExpression(out, expr->object)) { if (!EmitExpression(out, expr->object)) {
return false; return false;
} }
@ -347,7 +349,7 @@ bool GeneratorImpl::EmitIndexAccessor(std::ostream& out, const ast::IndexAccesso
return true; return true;
} }
bool GeneratorImpl::EmitBitcast(std::ostream& out, const ast::BitcastExpression* expr) { bool GeneratorImpl::EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr) {
auto* src_type = TypeOf(expr->expr)->UnwrapRef(); auto* src_type = TypeOf(expr->expr)->UnwrapRef();
auto* dst_type = TypeOf(expr)->UnwrapRef(); auto* dst_type = TypeOf(expr)->UnwrapRef();
@ -379,7 +381,7 @@ bool GeneratorImpl::EmitBitcast(std::ostream& out, const ast::BitcastExpression*
return false; return false;
} }
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->expr)) { if (!EmitExpression(out, expr->expr)) {
return false; return false;
} }
@ -399,7 +401,8 @@ bool GeneratorImpl::EmitAssign(const ast::AssignmentStatement* stmt) {
return true; return true;
} }
bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExpression* expr) { bool GeneratorImpl::EmitVectorRelational(utils::StringStream& out,
const ast::BinaryExpression* expr) {
switch (expr->op) { switch (expr->op) {
case ast::BinaryOp::kEqual: case ast::BinaryOp::kEqual:
out << "equal"; out << "equal";
@ -422,7 +425,7 @@ bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExp
default: default:
break; break;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->lhs)) { if (!EmitExpression(out, expr->lhs)) {
return false; return false;
} }
@ -433,7 +436,7 @@ bool GeneratorImpl::EmitVectorRelational(std::ostream& out, const ast::BinaryExp
return true; return true;
} }
bool GeneratorImpl::EmitBitwiseBoolOp(std::ostream& out, const ast::BinaryExpression* expr) { bool GeneratorImpl::EmitBitwiseBoolOp(utils::StringStream& out, const ast::BinaryExpression* expr) {
auto* bool_type = TypeOf(expr->lhs)->UnwrapRef(); auto* bool_type = TypeOf(expr->lhs)->UnwrapRef();
auto* uint_type = BoolTypeToUint(bool_type); auto* uint_type = BoolTypeToUint(bool_type);
@ -442,14 +445,14 @@ bool GeneratorImpl::EmitBitwiseBoolOp(std::ostream& out, const ast::BinaryExpres
"")) { "")) {
return false; return false;
} }
ScopedParen outerCastParen(out); ScopedParen outerCastParen(out.stream());
// Cast LHS to uint scalar or vector type. // Cast LHS to uint scalar or vector type.
if (!EmitType(out, uint_type, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, if (!EmitType(out, uint_type, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite,
"")) { "")) {
return false; return false;
} }
{ {
ScopedParen innerCastParen(out); ScopedParen innerCastParen(out.stream());
// Emit LHS. // Emit LHS.
if (!EmitExpression(out, expr->lhs)) { if (!EmitExpression(out, expr->lhs)) {
return false; return false;
@ -470,7 +473,7 @@ bool GeneratorImpl::EmitBitwiseBoolOp(std::ostream& out, const ast::BinaryExpres
return false; return false;
} }
{ {
ScopedParen innerCastParen(out); ScopedParen innerCastParen(out.stream());
// Emit RHS. // Emit RHS.
if (!EmitExpression(out, expr->rhs)) { if (!EmitExpression(out, expr->rhs)) {
return false; return false;
@ -479,7 +482,7 @@ bool GeneratorImpl::EmitBitwiseBoolOp(std::ostream& out, const ast::BinaryExpres
return true; return true;
} }
bool GeneratorImpl::EmitFloatModulo(std::ostream& out, const ast::BinaryExpression* expr) { bool GeneratorImpl::EmitFloatModulo(utils::StringStream& out, const ast::BinaryExpression* expr) {
std::string fn; std::string fn;
auto* ret_ty = TypeOf(expr)->UnwrapRef(); auto* ret_ty = TypeOf(expr)->UnwrapRef();
auto* lhs_ty = TypeOf(expr->lhs)->UnwrapRef(); auto* lhs_ty = TypeOf(expr->lhs)->UnwrapRef();
@ -529,7 +532,7 @@ bool GeneratorImpl::EmitFloatModulo(std::ostream& out, const ast::BinaryExpressi
// Call the helper // Call the helper
out << fn; out << fn;
{ {
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->lhs)) { if (!EmitExpression(out, expr->lhs)) {
return false; return false;
} }
@ -541,7 +544,7 @@ bool GeneratorImpl::EmitFloatModulo(std::ostream& out, const ast::BinaryExpressi
return true; return true;
} }
bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* expr) { bool GeneratorImpl::EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr) {
if (IsRelational(expr->op) && !TypeOf(expr->lhs)->UnwrapRef()->is_scalar()) { if (IsRelational(expr->op) && !TypeOf(expr->lhs)->UnwrapRef()->is_scalar()) {
return EmitVectorRelational(out, expr); return EmitVectorRelational(out, expr);
} }
@ -589,7 +592,7 @@ bool GeneratorImpl::EmitBinary(std::ostream& out, const ast::BinaryExpression* e
return EmitFloatModulo(out, expr); return EmitFloatModulo(out, expr);
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->lhs)) { if (!EmitExpression(out, expr->lhs)) {
return false; return false;
} }
@ -706,7 +709,7 @@ bool GeneratorImpl::EmitBreakIf(const ast::BreakIfStatement* b) {
return true; return true;
} }
bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitCall(utils::StringStream& out, const ast::CallExpression* expr) {
auto* call = builder_.Sem().Get<sem::Call>(expr); auto* call = builder_.Sem().Get<sem::Call>(expr);
return Switch( return Switch(
call->Target(), // call->Target(), //
@ -721,14 +724,14 @@ bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr)
}); });
} }
bool GeneratorImpl::EmitFunctionCall(std::ostream& out, bool GeneratorImpl::EmitFunctionCall(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::Function* fn) { const sem::Function* fn) {
const auto& args = call->Arguments(); const auto& args = call->Arguments();
auto* ident = fn->Declaration()->name; auto* ident = fn->Declaration()->name;
out << builder_.Symbols().NameFor(ident->symbol); out << builder_.Symbols().NameFor(ident->symbol);
ScopedParen sp(out); ScopedParen sp(out.stream());
bool first = true; bool first = true;
for (auto* arg : args) { for (auto* arg : args) {
@ -745,7 +748,7 @@ bool GeneratorImpl::EmitFunctionCall(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitBuiltinCall(std::ostream& out, bool GeneratorImpl::EmitBuiltinCall(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
auto* expr = call->Declaration(); auto* expr = call->Declaration();
@ -810,7 +813,7 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
} }
out << name; out << name;
ScopedParen sp(out); ScopedParen sp(out.stream());
bool first = true; bool first = true;
for (auto* arg : call->Arguments()) { for (auto* arg : call->Arguments()) {
@ -827,14 +830,14 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitValueConversion(std::ostream& out, bool GeneratorImpl::EmitValueConversion(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::ValueConversion* conv) { const sem::ValueConversion* conv) {
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined, if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) { builtin::Access::kReadWrite, "")) {
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, call->Arguments()[0]->Declaration())) { if (!EmitExpression(out, call->Arguments()[0]->Declaration())) {
return false; return false;
@ -843,7 +846,7 @@ bool GeneratorImpl::EmitValueConversion(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitValueConstructor(std::ostream& out, bool GeneratorImpl::EmitValueConstructor(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::ValueConstructor* ctor) { const sem::ValueConstructor* ctor) {
auto* type = ctor->ReturnType(); auto* type = ctor->ReturnType();
@ -857,7 +860,7 @@ bool GeneratorImpl::EmitValueConstructor(std::ostream& out,
if (!EmitType(out, type, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) { if (!EmitType(out, type, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) {
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
bool first = true; bool first = true;
for (auto* arg : call->Arguments()) { for (auto* arg : call->Arguments()) {
@ -874,13 +877,13 @@ bool GeneratorImpl::EmitValueConstructor(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out, bool GeneratorImpl::EmitWorkgroupAtomicCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
auto call = [&](const char* name) { auto call = [&](const char* name) {
out << name; out << name;
{ {
ScopedParen sp(out); ScopedParen sp(out.stream());
for (size_t i = 0; i < expr->args.Length(); i++) { for (size_t i = 0; i < expr->args.Length(); i++) {
auto* arg = expr->args[i]; auto* arg = expr->args[i];
if (i > 0) { if (i > 0) {
@ -900,7 +903,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
// atomicOr using 0 as the OR value // atomicOr using 0 as the OR value
out << "atomicOr"; out << "atomicOr";
{ {
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->args[0])) { if (!EmitExpression(out, expr->args[0])) {
return false; return false;
} }
@ -995,7 +998,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
return false; return false;
} }
bool GeneratorImpl::EmitArrayLength(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitArrayLength(utils::StringStream& out, const ast::CallExpression* expr) {
out << "uint("; out << "uint(";
if (!EmitExpression(out, expr->args[0])) { if (!EmitExpression(out, expr->args[0])) {
return false; return false;
@ -1004,7 +1007,7 @@ bool GeneratorImpl::EmitArrayLength(std::ostream& out, const ast::CallExpression
return true; return true;
} }
bool GeneratorImpl::EmitExtractBits(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitExtractBits(utils::StringStream& out, const ast::CallExpression* expr) {
out << "bitfieldExtract("; out << "bitfieldExtract(";
if (!EmitExpression(out, expr->args[0])) { if (!EmitExpression(out, expr->args[0])) {
return false; return false;
@ -1021,7 +1024,7 @@ bool GeneratorImpl::EmitExtractBits(std::ostream& out, const ast::CallExpression
return true; return true;
} }
bool GeneratorImpl::EmitInsertBits(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitInsertBits(utils::StringStream& out, const ast::CallExpression* expr) {
out << "bitfieldInsert("; out << "bitfieldInsert(";
if (!EmitExpression(out, expr->args[0])) { if (!EmitExpression(out, expr->args[0])) {
return false; return false;
@ -1042,7 +1045,7 @@ bool GeneratorImpl::EmitInsertBits(std::ostream& out, const ast::CallExpression*
return true; return true;
} }
bool GeneratorImpl::EmitEmulatedFMA(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitEmulatedFMA(utils::StringStream& out, const ast::CallExpression* expr) {
out << "(("; out << "((";
if (!EmitExpression(out, expr->args[0])) { if (!EmitExpression(out, expr->args[0])) {
return false; return false;
@ -1059,7 +1062,8 @@ bool GeneratorImpl::EmitEmulatedFMA(std::ostream& out, const ast::CallExpression
return true; return true;
} }
bool GeneratorImpl::EmitCountOneBitsCall(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitCountOneBitsCall(utils::StringStream& out,
const ast::CallExpression* expr) {
// GLSL's bitCount returns an integer type, so cast it to the appropriate // GLSL's bitCount returns an integer type, so cast it to the appropriate
// unsigned type. // unsigned type.
if (!EmitType(out, TypeOf(expr)->UnwrapRef(), builtin::AddressSpace::kUndefined, if (!EmitType(out, TypeOf(expr)->UnwrapRef(), builtin::AddressSpace::kUndefined,
@ -1075,7 +1079,7 @@ bool GeneratorImpl::EmitCountOneBitsCall(std::ostream& out, const ast::CallExpre
return true; return true;
} }
bool GeneratorImpl::EmitSelectCall(std::ostream& out, const ast::CallExpression* expr) { bool GeneratorImpl::EmitSelectCall(utils::StringStream& out, const ast::CallExpression* expr) {
auto* expr_false = expr->args[0]; auto* expr_false = expr->args[0];
auto* expr_true = expr->args[1]; auto* expr_true = expr->args[1];
auto* expr_cond = expr->args[2]; auto* expr_cond = expr->args[2];
@ -1097,7 +1101,7 @@ bool GeneratorImpl::EmitSelectCall(std::ostream& out, const ast::CallExpression*
out << ")"; out << ")";
return true; return true;
} }
ScopedParen paren(out); ScopedParen paren(out.stream());
if (!EmitExpression(out, expr_cond)) { if (!EmitExpression(out, expr_cond)) {
return false; return false;
} }
@ -1117,7 +1121,7 @@ bool GeneratorImpl::EmitSelectCall(std::ostream& out, const ast::CallExpression*
return true; return true;
} }
bool GeneratorImpl::EmitDotCall(std::ostream& out, bool GeneratorImpl::EmitDotCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
auto* vec_ty = builtin->Parameters()[0]->Type()->As<type::Vector>(); auto* vec_ty = builtin->Parameters()[0]->Type()->As<type::Vector>();
@ -1133,7 +1137,7 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out,
std::string v; std::string v;
{ {
std::stringstream s; utils::StringStream s;
if (!EmitType(s, vec_ty->type(), builtin::AddressSpace::kUndefined, if (!EmitType(s, vec_ty->type(), builtin::AddressSpace::kUndefined,
builtin::Access::kRead, "")) { builtin::Access::kRead, "")) {
return ""; return "";
@ -1178,7 +1182,7 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out,
} }
out << fn; out << fn;
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->args[0])) { if (!EmitExpression(out, expr->args[0])) {
return false; return false;
@ -1190,7 +1194,7 @@ bool GeneratorImpl::EmitDotCall(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitModfCall(std::ostream& out, bool GeneratorImpl::EmitModfCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
TINT_ASSERT(Writer, expr->args.Length() == 1); TINT_ASSERT(Writer, expr->args.Length() == 1);
@ -1216,7 +1220,7 @@ bool GeneratorImpl::EmitModfCall(std::ostream& out,
}); });
} }
bool GeneratorImpl::EmitFrexpCall(std::ostream& out, bool GeneratorImpl::EmitFrexpCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
TINT_ASSERT(Writer, expr->args.Length() == 1); TINT_ASSERT(Writer, expr->args.Length() == 1);
@ -1242,7 +1246,7 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out,
}); });
} }
bool GeneratorImpl::EmitDegreesCall(std::ostream& out, bool GeneratorImpl::EmitDegreesCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
auto* return_elem_type = type::Type::DeepestElementOf(builtin->ReturnType()); auto* return_elem_type = type::Type::DeepestElementOf(builtin->ReturnType());
@ -1255,7 +1259,7 @@ bool GeneratorImpl::EmitDegreesCall(std::ostream& out,
}); });
} }
bool GeneratorImpl::EmitRadiansCall(std::ostream& out, bool GeneratorImpl::EmitRadiansCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
auto* return_elem_type = type::Type::DeepestElementOf(builtin->ReturnType()); auto* return_elem_type = type::Type::DeepestElementOf(builtin->ReturnType());
@ -1268,7 +1272,7 @@ bool GeneratorImpl::EmitRadiansCall(std::ostream& out,
}); });
} }
bool GeneratorImpl::EmitQuantizeToF16Call(std::ostream& out, bool GeneratorImpl::EmitQuantizeToF16Call(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
// Emulate by casting to f16 and back again. // Emulate by casting to f16 and back again.
@ -1300,7 +1304,7 @@ bool GeneratorImpl::EmitQuantizeToF16Call(std::ostream& out,
}); });
} }
bool GeneratorImpl::EmitBarrierCall(std::ostream& out, const sem::Builtin* builtin) { bool GeneratorImpl::EmitBarrierCall(utils::StringStream& out, const sem::Builtin* builtin) {
// TODO(crbug.com/tint/661): Combine sequential barriers to a single // TODO(crbug.com/tint/661): Combine sequential barriers to a single
// instruction. // instruction.
if (builtin->Type() == sem::BuiltinType::kWorkgroupBarrier) { if (builtin->Type() == sem::BuiltinType::kWorkgroupBarrier) {
@ -1325,7 +1329,7 @@ const ast::Expression* GeneratorImpl::CreateF32Zero(const sem::Statement* stmt)
return zero; return zero;
} }
bool GeneratorImpl::EmitTextureCall(std::ostream& out, bool GeneratorImpl::EmitTextureCall(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::Builtin* builtin) { const sem::Builtin* builtin) {
using Usage = sem::ParameterUsage; using Usage = sem::ParameterUsage;
@ -1374,7 +1378,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
return EmitExpression(out, e); return EmitExpression(out, e);
} }
emit_signed_int_type(ty); emit_signed_int_type(ty);
ScopedParen sp(out); ScopedParen sp(out.stream());
return EmitExpression(out, e); return EmitExpression(out, e);
}; };
@ -1384,7 +1388,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
// textureSize() / imageSize() returns a signed scalar / vector in GLSL. // textureSize() / imageSize() returns a signed scalar / vector in GLSL.
// Cast. // Cast.
emit_unsigned_int_type(call->Type()); emit_unsigned_int_type(call->Type());
ScopedParen sp(out); ScopedParen sp(out.stream());
if (texture_type->Is<type::StorageTexture>()) { if (texture_type->Is<type::StorageTexture>()) {
out << "imageSize("; out << "imageSize(";
@ -1423,7 +1427,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
// textureSize() / imageSize() returns a signed scalar / vector in GLSL. // textureSize() / imageSize() returns a signed scalar / vector in GLSL.
// Cast. // Cast.
out << "uint"; out << "uint";
ScopedParen sp(out); ScopedParen sp(out.stream());
if (texture_type->Is<type::StorageTexture>()) { if (texture_type->Is<type::StorageTexture>()) {
out << "imageSize("; out << "imageSize(";
@ -1457,7 +1461,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
// textureQueryLevels() returns a signed scalar in GLSL. // textureQueryLevels() returns a signed scalar in GLSL.
// Cast. // Cast.
out << "uint"; out << "uint";
ScopedParen sp(out); ScopedParen sp(out.stream());
out << "textureQueryLevels("; out << "textureQueryLevels(";
if (!EmitExpression(out, texture)) { if (!EmitExpression(out, texture)) {
@ -1471,7 +1475,7 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
// textureSamples() returns a signed scalar in GLSL. // textureSamples() returns a signed scalar in GLSL.
// Cast. // Cast.
out << "uint"; out << "uint";
ScopedParen sp(out); ScopedParen sp(out.stream());
out << "textureSamples("; out << "textureSamples(";
if (!EmitExpression(out, texture)) { if (!EmitExpression(out, texture)) {
@ -1818,7 +1822,7 @@ bool GeneratorImpl::EmitDiscard(const ast::DiscardStatement*) {
return true; return true;
} }
bool GeneratorImpl::EmitExpression(std::ostream& out, const ast::Expression* expr) { bool GeneratorImpl::EmitExpression(utils::StringStream& out, const ast::Expression* expr) {
if (auto* sem = builder_.Sem().GetVal(expr)) { if (auto* sem = builder_.Sem().GetVal(expr)) {
if (auto* constant = sem->ConstantValue()) { if (auto* constant = sem->ConstantValue()) {
return EmitConstant(out, constant); return EmitConstant(out, constant);
@ -1841,7 +1845,8 @@ bool GeneratorImpl::EmitExpression(std::ostream& out, const ast::Expression* exp
}); });
} }
bool GeneratorImpl::EmitIdentifier(std::ostream& out, const ast::IdentifierExpression* expr) { bool GeneratorImpl::EmitIdentifier(utils::StringStream& out,
const ast::IdentifierExpression* expr) {
out << builder_.Symbols().NameFor(expr->identifier->symbol); out << builder_.Symbols().NameFor(expr->identifier->symbol);
return true; return true;
} }
@ -2187,7 +2192,7 @@ bool GeneratorImpl::EmitIOVariable(const sem::GlobalVariable* var) {
} }
void GeneratorImpl::EmitInterpolationQualifiers( void GeneratorImpl::EmitInterpolationQualifiers(
std::ostream& out, utils::StringStream& out,
utils::VectorRef<const ast::Attribute*> attributes) { utils::VectorRef<const ast::Attribute*> attributes) {
for (auto* attr : attributes) { for (auto* attr : attributes) {
if (auto* interpolate = attr->As<ast::InterpolateAttribute>()) { if (auto* interpolate = attr->As<ast::InterpolateAttribute>()) {
@ -2223,7 +2228,7 @@ void GeneratorImpl::EmitInterpolationQualifiers(
} }
} }
bool GeneratorImpl::EmitAttributes(std::ostream& out, bool GeneratorImpl::EmitAttributes(utils::StringStream& out,
const sem::GlobalVariable* var, const sem::GlobalVariable* var,
utils::VectorRef<const ast::Attribute*> attributes) { utils::VectorRef<const ast::Attribute*> attributes) {
if (attributes.IsEmpty()) { if (attributes.IsEmpty()) {
@ -2333,7 +2338,7 @@ bool GeneratorImpl::EmitEntryPointFunction(const ast::Function* func) {
return true; return true;
} }
bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Value* constant) { bool GeneratorImpl::EmitConstant(utils::StringStream& out, const constant::Value* constant) {
return Switch( return Switch(
constant->Type(), // constant->Type(), //
[&](const type::Bool*) { [&](const type::Bool*) {
@ -2362,7 +2367,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Value* const
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
if (constant->AllEqual()) { if (constant->AllEqual()) {
return EmitConstant(out, constant->Index(0)); return EmitConstant(out, constant->Index(0));
@ -2384,7 +2389,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Value* const
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
for (size_t column_idx = 0; column_idx < m->columns(); column_idx++) { for (size_t column_idx = 0; column_idx < m->columns(); column_idx++) {
if (column_idx > 0) { if (column_idx > 0) {
@ -2402,7 +2407,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Value* const
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
auto count = a->ConstantCount(); auto count = a->ConstantCount();
if (!count) { if (!count) {
@ -2429,7 +2434,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Value* const
out << StructName(s); out << StructName(s);
ScopedParen sp(out); ScopedParen sp(out.stream());
for (size_t i = 0; i < s->Members().Length(); i++) { for (size_t i = 0; i < s->Members().Length(); i++) {
if (i > 0) { if (i > 0) {
@ -2450,7 +2455,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const constant::Value* const
}); });
} }
bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression* lit) { bool GeneratorImpl::EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit) {
return Switch( return Switch(
lit, lit,
[&](const ast::BoolLiteralExpression* l) { [&](const ast::BoolLiteralExpression* l) {
@ -2478,7 +2483,7 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, const ast::LiteralExpression*
}); });
} }
bool GeneratorImpl::EmitZeroValue(std::ostream& out, const type::Type* type) { bool GeneratorImpl::EmitZeroValue(utils::StringStream& out, const type::Type* type) {
if (type->Is<type::Bool>()) { if (type->Is<type::Bool>()) {
out << "false"; out << "false";
} else if (type->Is<type::F32>()) { } else if (type->Is<type::F32>()) {
@ -2494,7 +2499,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const type::Type* type) {
"")) { "")) {
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
for (uint32_t i = 0; i < vec->Width(); i++) { for (uint32_t i = 0; i < vec->Width(); i++) {
if (i != 0) { if (i != 0) {
out << ", "; out << ", ";
@ -2508,7 +2513,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const type::Type* type) {
"")) { "")) {
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
for (uint32_t i = 0; i < (mat->rows() * mat->columns()); i++) { for (uint32_t i = 0; i < (mat->rows() * mat->columns()); i++) {
if (i != 0) { if (i != 0) {
out << ", "; out << ", ";
@ -2523,7 +2528,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const type::Type* type) {
return false; return false;
} }
bool first = true; bool first = true;
ScopedParen sp(out); ScopedParen sp(out.stream());
for (auto* member : str->Members()) { for (auto* member : str->Members()) {
if (!first) { if (!first) {
out << ", "; out << ", ";
@ -2537,7 +2542,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const type::Type* type) {
"")) { "")) {
return false; return false;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
auto count = arr->ConstantCount(); auto count = arr->ConstantCount();
if (!count) { if (!count) {
@ -2604,7 +2609,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) {
} }
TextBuffer cond_pre; TextBuffer cond_pre;
std::stringstream cond_buf; utils::StringStream cond_buf;
if (auto* cond = stmt->condition) { if (auto* cond = stmt->condition) {
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre); TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
if (!EmitExpression(cond_buf, cond)) { if (!EmitExpression(cond_buf, cond)) {
@ -2696,7 +2701,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) {
bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) { bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) {
TextBuffer cond_pre; TextBuffer cond_pre;
std::stringstream cond_buf; utils::StringStream cond_buf;
{ {
auto* cond = stmt->condition; auto* cond = stmt->condition;
TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre); TINT_SCOPED_ASSIGNMENT(current_buffer_, &cond_pre);
@ -2745,7 +2750,7 @@ bool GeneratorImpl::EmitWhile(const ast::WhileStatement* stmt) {
return true; return true;
} }
bool GeneratorImpl::EmitMemberAccessor(std::ostream& out, bool GeneratorImpl::EmitMemberAccessor(utils::StringStream& out,
const ast::MemberAccessorExpression* expr) { const ast::MemberAccessorExpression* expr) {
if (!EmitExpression(out, expr->object)) { if (!EmitExpression(out, expr->object)) {
return false; return false;
@ -2857,7 +2862,7 @@ bool GeneratorImpl::EmitSwitch(const ast::SwitchStatement* stmt) {
return true; return true;
} }
bool GeneratorImpl::EmitType(std::ostream& out, bool GeneratorImpl::EmitType(utils::StringStream& out,
const type::Type* type, const type::Type* type,
builtin::AddressSpace address_space, builtin::AddressSpace address_space,
builtin::Access access, builtin::Access access,
@ -3038,7 +3043,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
return true; return true;
} }
bool GeneratorImpl::EmitTypeAndName(std::ostream& out, bool GeneratorImpl::EmitTypeAndName(utils::StringStream& out,
const type::Type* type, const type::Type* type,
builtin::AddressSpace address_space, builtin::AddressSpace address_space,
builtin::Access access, builtin::Access access,
@ -3086,7 +3091,7 @@ bool GeneratorImpl::EmitStructMembers(TextBuffer* b, const sem::Struct* str) {
return true; return true;
} }
bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* expr) { bool GeneratorImpl::EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr) {
switch (expr->op) { switch (expr->op) {
case ast::UnaryOp::kIndirection: case ast::UnaryOp::kIndirection:
case ast::UnaryOp::kAddressOf: case ast::UnaryOp::kAddressOf:
@ -3106,7 +3111,7 @@ bool GeneratorImpl::EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression*
break; break;
} }
ScopedParen sp(out); ScopedParen sp(out.stream());
if (!EmitExpression(out, expr->expr)) { if (!EmitExpression(out, expr->expr)) {
return false; return false;
} }
@ -3182,7 +3187,7 @@ bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) {
} }
template <typename F> template <typename F>
bool GeneratorImpl::CallBuiltinHelper(std::ostream& out, bool GeneratorImpl::CallBuiltinHelper(utils::StringStream& out,
const ast::CallExpression* call, const ast::CallExpression* call,
const sem::Builtin* builtin, const sem::Builtin* builtin,
F&& build) { F&& build) {
@ -3238,7 +3243,7 @@ bool GeneratorImpl::CallBuiltinHelper(std::ostream& out,
// Call the helper // Call the helper
out << fn; out << fn;
{ {
ScopedParen sp(out); ScopedParen sp(out.stream());
bool first = true; bool first = true;
for (auto* arg : call->args) { for (auto* arg : call->args) {
if (!first) { if (!first) {

View File

@ -37,6 +37,7 @@
#include "src/tint/scope_stack.h" #include "src/tint/scope_stack.h"
#include "src/tint/transform/decompose_memory_access.h" #include "src/tint/transform/decompose_memory_access.h"
#include "src/tint/utils/hash.h" #include "src/tint/utils/hash.h"
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/generator.h" #include "src/tint/writer/glsl/generator.h"
#include "src/tint/writer/glsl/version.h" #include "src/tint/writer/glsl/version.h"
#include "src/tint/writer/text_generator.h" #include "src/tint/writer/text_generator.h"
@ -93,7 +94,7 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the expression to emit /// @param expr the expression to emit
/// @returns true if the index accessor was emitted /// @returns true if the index accessor was emitted
bool EmitIndexAccessor(std::ostream& out, const ast::IndexAccessorExpression* expr); bool EmitIndexAccessor(utils::StringStream& out, const ast::IndexAccessorExpression* expr);
/// Handles an assignment statement /// Handles an assignment statement
/// @param stmt the statement to emit /// @param stmt the statement to emit
/// @returns true if the statement was emitted successfully /// @returns true if the statement was emitted successfully
@ -102,27 +103,27 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the binary expression /// @param expr the binary expression
/// @returns true if the expression was emitted, false otherwise /// @returns true if the expression was emitted, false otherwise
bool EmitBitwiseBoolOp(std::ostream& out, const ast::BinaryExpression* expr); bool EmitBitwiseBoolOp(utils::StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a binary expression /// Handles generating a binary expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the binary expression /// @param expr the binary expression
/// @returns true if the expression was emitted, false otherwise /// @returns true if the expression was emitted, false otherwise
bool EmitFloatModulo(std::ostream& out, const ast::BinaryExpression* expr); bool EmitFloatModulo(utils::StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating the modulo operator on float vector operands /// Handles generating the modulo operator on float vector operands
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the binary expression /// @param expr the binary expression
/// @returns true if the expression was emitted, false otherwise /// @returns true if the expression was emitted, false otherwise
bool EmitBinary(std::ostream& out, const ast::BinaryExpression* expr); bool EmitBinary(utils::StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a bitcast expression /// Handles generating a bitcast expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the expression /// @param expr the expression
/// @returns true if the binary expression was emitted /// @returns true if the binary expression was emitted
bool EmitVectorRelational(std::ostream& out, const ast::BinaryExpression* expr); bool EmitVectorRelational(utils::StringStream& out, const ast::BinaryExpression* expr);
/// Handles generating a vector relational expression /// Handles generating a vector relational expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the expression /// @param expr the expression
/// @returns true if the vector relational expression was emitted /// @returns true if the vector relational expression was emitted
bool EmitBitcast(std::ostream& out, const ast::BitcastExpression* expr); bool EmitBitcast(utils::StringStream& out, const ast::BitcastExpression* expr);
/// Emits a list of statements /// Emits a list of statements
/// @param stmts the statement list /// @param stmts the statement list
/// @returns true if the statements were emitted successfully /// @returns true if the statements were emitted successfully
@ -147,25 +148,27 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitCall(std::ostream& out, const ast::CallExpression* expr); bool EmitCall(utils::StringStream& out, const ast::CallExpression* expr);
/// Handles generating a function call expression /// Handles generating a function call expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param call the call expression /// @param call the call expression
/// @param fn the function being called /// @param fn the function being called
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitFunctionCall(std::ostream& out, const sem::Call* call, const sem::Function* fn); bool EmitFunctionCall(utils::StringStream& out, const sem::Call* call, const sem::Function* fn);
/// Handles generating a builtin call expression /// Handles generating a builtin call expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param call the call expression /// @param call the call expression
/// @param builtin the builtin being called /// @param builtin the builtin being called
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin); bool EmitBuiltinCall(utils::StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin);
/// Handles generating a value conversion expression /// Handles generating a value conversion expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param call the call expression /// @param call the call expression
/// @param conv the value conversion /// @param conv the value conversion
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitValueConversion(std::ostream& out, bool EmitValueConversion(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::ValueConversion* conv); const sem::ValueConversion* conv);
/// Handles generating a value constructor expression /// Handles generating a value constructor expression
@ -173,42 +176,42 @@ class GeneratorImpl : public TextGenerator {
/// @param call the call expression /// @param call the call expression
/// @param ctor the value constructor /// @param ctor the value constructor
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitValueConstructor(std::ostream& out, bool EmitValueConstructor(utils::StringStream& out,
const sem::Call* call, const sem::Call* call,
const sem::ValueConstructor* ctor); const sem::ValueConstructor* ctor);
/// Handles generating a barrier builtin call /// Handles generating a barrier builtin call
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param builtin the semantic information for the barrier builtin /// @param builtin the semantic information for the barrier builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitBarrierCall(std::ostream& out, const sem::Builtin* builtin); bool EmitBarrierCall(utils::StringStream& out, const sem::Builtin* builtin);
/// Handles generating an atomic builtin call for a workgroup variable /// Handles generating an atomic builtin call for a workgroup variable
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the atomic builtin /// @param builtin the semantic information for the atomic builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitWorkgroupAtomicCall(std::ostream& out, bool EmitWorkgroupAtomicCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles generating an array.length() call /// Handles generating an array.length() call
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @returns true if the array length expression is emitted /// @returns true if the array length expression is emitted
bool EmitArrayLength(std::ostream& out, const ast::CallExpression* expr); bool EmitArrayLength(utils::StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to `bitfieldExtract` /// Handles generating a call to `bitfieldExtract`
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitExtractBits(std::ostream& out, const ast::CallExpression* expr); bool EmitExtractBits(utils::StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to `bitfieldInsert` /// Handles generating a call to `bitfieldInsert`
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitInsertBits(std::ostream& out, const ast::CallExpression* expr); bool EmitInsertBits(utils::StringStream& out, const ast::CallExpression* expr);
/// Emulates 'fma' on GLSL ES, where it is unsupported. /// Emulates 'fma' on GLSL ES, where it is unsupported.
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the fma() expression /// @param expr the fma() expression
/// @returns true if the expression is emitted /// @returns true if the expression is emitted
bool EmitEmulatedFMA(std::ostream& out, const ast::CallExpression* expr); bool EmitEmulatedFMA(utils::StringStream& out, const ast::CallExpression* expr);
/// Create a float literal zero AST node, and associated semantic nodes. /// Create a float literal zero AST node, and associated semantic nodes.
/// @param stmt the statement which will own the semantic expression node /// @param stmt the statement which will own the semantic expression node
/// @returns an AST expression representing 0.0f /// @returns an AST expression representing 0.0f
@ -220,23 +223,25 @@ class GeneratorImpl : public TextGenerator {
/// @param call the call expression /// @param call the call expression
/// @param builtin the semantic information for the texture builtin /// @param builtin the semantic information for the texture builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitTextureCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin); bool EmitTextureCall(utils::StringStream& out,
const sem::Call* call,
const sem::Builtin* builtin);
/// Handles generating a call to the `select()` builtin /// Handles generating a call to the `select()` builtin
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitCountOneBitsCall(std::ostream& out, const ast::CallExpression* expr); bool EmitCountOneBitsCall(utils::StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to the `countOneBits()` builtin /// Handles generating a call to the `countOneBits()` builtin
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitSelectCall(std::ostream& out, const ast::CallExpression* expr); bool EmitSelectCall(utils::StringStream& out, const ast::CallExpression* expr);
/// Handles generating a call to the `dot()` builtin /// Handles generating a call to the `dot()` builtin
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the builtin /// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitDotCall(std::ostream& out, bool EmitDotCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles generating a call to the `modf()` builtin /// Handles generating a call to the `modf()` builtin
@ -244,7 +249,7 @@ class GeneratorImpl : public TextGenerator {
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the builtin /// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitModfCall(std::ostream& out, bool EmitModfCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles generating a call to the `frexp()` builtin /// Handles generating a call to the `frexp()` builtin
@ -252,7 +257,7 @@ class GeneratorImpl : public TextGenerator {
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the builtin /// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitFrexpCall(std::ostream& out, bool EmitFrexpCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles generating a call to the `degrees()` builtin /// Handles generating a call to the `degrees()` builtin
@ -260,7 +265,7 @@ class GeneratorImpl : public TextGenerator {
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the builtin /// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitDegreesCall(std::ostream& out, bool EmitDegreesCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles generating a call to the `radians()` builtin /// Handles generating a call to the `radians()` builtin
@ -268,7 +273,7 @@ class GeneratorImpl : public TextGenerator {
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the builtin /// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitRadiansCall(std::ostream& out, bool EmitRadiansCall(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles generating a call to the `quantizeToF16()` intrinsic /// Handles generating a call to the `quantizeToF16()` intrinsic
@ -276,7 +281,7 @@ class GeneratorImpl : public TextGenerator {
/// @param expr the call expression /// @param expr the call expression
/// @param builtin the semantic information for the builtin /// @param builtin the semantic information for the builtin
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
bool EmitQuantizeToF16Call(std::ostream& out, bool EmitQuantizeToF16Call(utils::StringStream& out,
const ast::CallExpression* expr, const ast::CallExpression* expr,
const sem::Builtin* builtin); const sem::Builtin* builtin);
/// Handles a case statement /// Handles a case statement
@ -295,7 +300,7 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the expression /// @param expr the expression
/// @returns true if the expression was emitted /// @returns true if the expression was emitted
bool EmitExpression(std::ostream& out, const ast::Expression* expr); bool EmitExpression(utils::StringStream& out, const ast::Expression* expr);
/// Handles generating a function /// Handles generating a function
/// @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
@ -342,14 +347,14 @@ class GeneratorImpl : public TextGenerator {
/// Handles emitting interpolation qualifiers /// Handles emitting interpolation qualifiers
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param attrs the attributes /// @param attrs the attributes
void EmitInterpolationQualifiers(std::ostream& out, void EmitInterpolationQualifiers(utils::StringStream& out,
utils::VectorRef<const ast::Attribute*> attrs); utils::VectorRef<const ast::Attribute*> attrs);
/// Handles emitting attributes /// Handles emitting attributes
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param var the global variable semantics /// @param var the global variable semantics
/// @param attrs the attributes /// @param attrs the attributes
/// @returns true if the attributes were emitted /// @returns true if the attributes were emitted
bool EmitAttributes(std::ostream& out, bool EmitAttributes(utils::StringStream& out,
const sem::GlobalVariable* var, const sem::GlobalVariable* var,
utils::VectorRef<const ast::Attribute*> attrs); utils::VectorRef<const ast::Attribute*> attrs);
/// Handles emitting the entry point function /// Handles emitting the entry point function
@ -364,12 +369,12 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output stream /// @param out the output stream
/// @param constant the constant value to emit /// @param constant the constant value to emit
/// @returns true if the constant value was successfully emitted /// @returns true if the constant value was successfully emitted
bool EmitConstant(std::ostream& out, const constant::Value* constant); bool EmitConstant(utils::StringStream& out, const constant::Value* constant);
/// Handles a literal /// Handles a literal
/// @param out the output stream /// @param out the output stream
/// @param lit the literal to emit /// @param lit the literal to emit
/// @returns true if the literal was successfully emitted /// @returns true if the literal was successfully emitted
bool EmitLiteral(std::ostream& out, const ast::LiteralExpression* lit); bool EmitLiteral(utils::StringStream& out, const ast::LiteralExpression* lit);
/// Handles a loop statement /// Handles a loop statement
/// @param stmt the statement to emit /// @param stmt the statement to emit
/// @returns true if the statement was emitted /// @returns true if the statement was emitted
@ -386,12 +391,12 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the identifier expression /// @param expr the identifier expression
/// @returns true if the identifier was emitted /// @returns true if the identifier was emitted
bool EmitIdentifier(std::ostream& out, const ast::IdentifierExpression* expr); bool EmitIdentifier(utils::StringStream& out, const ast::IdentifierExpression* expr);
/// Handles a member accessor expression /// Handles a member accessor expression
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the member accessor expression /// @param expr the member accessor expression
/// @returns true if the member accessor was emitted /// @returns true if the member accessor was emitted
bool EmitMemberAccessor(std::ostream& out, const ast::MemberAccessorExpression* expr); bool EmitMemberAccessor(utils::StringStream& out, const ast::MemberAccessorExpression* expr);
/// Handles return statements /// Handles return statements
/// @param stmt the statement to emit /// @param stmt the statement to emit
/// @returns true if the statement was successfully emitted /// @returns true if the statement was successfully emitted
@ -413,7 +418,7 @@ class GeneratorImpl : public TextGenerator {
/// @param name_printed (optional) if not nullptr and an array was printed /// @param name_printed (optional) if not nullptr and an array was printed
/// then the boolean is set to true. /// then the boolean is set to true.
/// @returns true if the type is emitted /// @returns true if the type is emitted
bool EmitType(std::ostream& out, bool EmitType(utils::StringStream& out,
const type::Type* type, const type::Type* type,
builtin::AddressSpace address_space, builtin::AddressSpace address_space,
builtin::Access access, builtin::Access access,
@ -426,7 +431,7 @@ class GeneratorImpl : public TextGenerator {
/// @param access the access control type of the variable /// @param access the access control type of the variable
/// @param name the name to emit /// @param name the name to emit
/// @returns true if the type is emitted /// @returns true if the type is emitted
bool EmitTypeAndName(std::ostream& out, bool EmitTypeAndName(utils::StringStream& out,
const type::Type* type, const type::Type* type,
builtin::AddressSpace address_space, builtin::AddressSpace address_space,
builtin::Access access, builtin::Access access,
@ -446,12 +451,12 @@ class GeneratorImpl : public TextGenerator {
/// @param out the output of the expression stream /// @param out the output of the expression stream
/// @param expr the expression to emit /// @param expr the expression to emit
/// @returns true if the expression was emitted /// @returns true if the expression was emitted
bool EmitUnaryOp(std::ostream& out, const ast::UnaryOpExpression* expr); bool EmitUnaryOp(utils::StringStream& out, const ast::UnaryOpExpression* expr);
/// Emits the zero value for the given type /// Emits the zero value for the given type
/// @param out the output stream /// @param out the output stream
/// @param type the type to emit the value for /// @param type the type to emit the value for
/// @returns true if the zero value was successfully emitted. /// @returns true if the zero value was successfully emitted.
bool EmitZeroValue(std::ostream& out, const type::Type* type); bool EmitZeroValue(utils::StringStream& out, const type::Type* type);
/// Handles generating a 'var' declaration /// Handles generating a 'var' declaration
/// @param var the variable to generate /// @param var the variable to generate
/// @returns true if the variable was emitted /// @returns true if the variable was emitted
@ -504,7 +509,7 @@ class GeneratorImpl : public TextGenerator {
/// `params` is the name of all the generated function parameters /// `params` is the name of all the generated function parameters
/// @returns true if the call expression is emitted /// @returns true if the call expression is emitted
template <typename F> template <typename F>
bool CallBuiltinHelper(std::ostream& out, bool CallBuiltinHelper(utils::StringStream& out,
const ast::CallExpression* call, const ast::CallExpression* call,
const sem::Builtin* builtin, const sem::Builtin* builtin,
F&& build); F&& build);

View File

@ -14,6 +14,8 @@
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
#include "src/tint/utils/string_stream.h"
using namespace tint::number_suffixes; // NOLINT using namespace tint::number_suffixes; // NOLINT
namespace tint::writer::glsl { namespace tint::writer::glsl {
@ -28,7 +30,7 @@ TEST_F(GlslGeneratorImplTest_Expression, IndexAccessor) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "ary[5]"); EXPECT_EQ(out.str(), "ary[5]");
} }

View File

@ -14,6 +14,7 @@
#include "src/tint/ast/call_statement.h" #include "src/tint/ast/call_statement.h"
#include "src/tint/ast/variable_decl_statement.h" #include "src/tint/ast/variable_decl_statement.h"
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
using namespace tint::number_suffixes; // NOLINT using namespace tint::number_suffixes; // NOLINT
@ -55,7 +56,7 @@ TEST_P(GlslBinaryTest, Emit_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), params.result); EXPECT_EQ(out.str(), params.result);
} }
@ -83,7 +84,7 @@ TEST_P(GlslBinaryTest, Emit_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), params.result); EXPECT_EQ(out.str(), params.result);
} }
@ -102,7 +103,7 @@ TEST_P(GlslBinaryTest, Emit_u32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), params.result); EXPECT_EQ(out.str(), params.result);
} }
@ -126,7 +127,7 @@ TEST_P(GlslBinaryTest, Emit_i32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), params.result); EXPECT_EQ(out.str(), params.result);
} }
@ -161,7 +162,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(a * 1.0f)"); EXPECT_EQ(out.str(), "(a * 1.0f)");
} }
@ -179,7 +180,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(a * 1.0hf)"); EXPECT_EQ(out.str(), "(a * 1.0hf)");
} }
@ -195,7 +196,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(1.0f * a)"); EXPECT_EQ(out.str(), "(1.0f * a)");
} }
@ -213,7 +214,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(1.0hf * a)"); EXPECT_EQ(out.str(), "(1.0hf * a)");
} }
@ -228,7 +229,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(mat * 1.0f)"); EXPECT_EQ(out.str(), "(mat * 1.0f)");
} }
@ -245,7 +246,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(mat * 1.0hf)"); EXPECT_EQ(out.str(), "(mat * 1.0hf)");
} }
@ -260,7 +261,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(1.0f * mat)"); EXPECT_EQ(out.str(), "(1.0f * mat)");
} }
@ -277,7 +278,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(1.0hf * mat)"); EXPECT_EQ(out.str(), "(1.0hf * mat)");
} }
@ -292,7 +293,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(mat * vec3(1.0f))"); EXPECT_EQ(out.str(), "(mat * vec3(1.0f))");
} }
@ -309,7 +310,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(mat * f16vec3(1.0hf))"); EXPECT_EQ(out.str(), "(mat * f16vec3(1.0hf))");
} }
@ -324,7 +325,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(vec3(1.0f) * mat)"); EXPECT_EQ(out.str(), "(vec3(1.0f) * mat)");
} }
@ -341,7 +342,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(f16vec3(1.0hf) * mat)"); EXPECT_EQ(out.str(), "(f16vec3(1.0hf) * mat)");
} }
@ -355,7 +356,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(lhs * rhs)"); EXPECT_EQ(out.str(), "(lhs * rhs)");
} }
@ -371,7 +372,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); EXPECT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(lhs * rhs)"); EXPECT_EQ(out.str(), "(lhs * rhs)");
} }
@ -385,7 +386,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModF32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -401,7 +402,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModF16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -415,7 +416,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -431,7 +432,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -445,7 +446,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32ScalarF32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -461,7 +462,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16ScalarF16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -475,7 +476,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModScalarF32Vec3F32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -491,7 +492,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModScalarF16Vec3F16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "tint_float_modulo(a, b)"); EXPECT_EQ(out.str(), "tint_float_modulo(a, b)");
} }
@ -592,7 +593,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Logical_And) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(tint_tmp)"); EXPECT_EQ(out.str(), "(tint_tmp)");
EXPECT_EQ(gen.result(), R"(bool tint_tmp = a; EXPECT_EQ(gen.result(), R"(bool tint_tmp = a;
@ -617,7 +618,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Logical_Multi) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(tint_tmp)"); EXPECT_EQ(out.str(), "(tint_tmp)");
EXPECT_EQ(gen.result(), R"(bool tint_tmp_1 = a; EXPECT_EQ(gen.result(), R"(bool tint_tmp_1 = a;
@ -644,7 +645,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Logical_Or) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, expr)) << gen.error();
EXPECT_EQ(out.str(), "(tint_tmp)"); EXPECT_EQ(out.str(), "(tint_tmp)");
EXPECT_EQ(gen.result(), R"(bool tint_tmp = a; EXPECT_EQ(gen.result(), R"(bool tint_tmp = a;

View File

@ -14,6 +14,8 @@
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
#include "src/tint/utils/string_stream.h"
using namespace tint::number_suffixes; // NOLINT using namespace tint::number_suffixes; // NOLINT
namespace tint::writer::glsl { namespace tint::writer::glsl {
@ -28,7 +30,7 @@ TEST_F(GlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Float) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.error();
EXPECT_EQ(out.str(), "intBitsToFloat(a)"); EXPECT_EQ(out.str(), "intBitsToFloat(a)");
} }
@ -40,7 +42,7 @@ TEST_F(GlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Int) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.error();
EXPECT_EQ(out.str(), "int(a)"); EXPECT_EQ(out.str(), "int(a)");
} }
@ -52,7 +54,7 @@ TEST_F(GlslGeneratorImplTest_Bitcast, EmitExpression_Bitcast_Uint) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, bitcast)) << gen.error();
EXPECT_EQ(out.str(), "uint(a)"); EXPECT_EQ(out.str(), "uint(a)");
} }

View File

@ -16,6 +16,7 @@
#include "src/tint/ast/call_statement.h" #include "src/tint/ast/call_statement.h"
#include "src/tint/ast/stage_attribute.h" #include "src/tint/ast/stage_attribute.h"
#include "src/tint/sem/call.h" #include "src/tint/sem/call.h"
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
using ::testing::HasSubstr; using ::testing::HasSubstr;
@ -65,8 +66,8 @@ const ast::CallExpression* GenerateCall(BuiltinType builtin,
CallParamType type, CallParamType type,
ProgramBuilder* builder) { ProgramBuilder* builder) {
std::string name; std::string name;
std::ostringstream str(name); utils::StringStream str;
str << builtin; str << name << builtin;
switch (builtin) { switch (builtin) {
case BuiltinType::kAcos: case BuiltinType::kAcos:
case BuiltinType::kAsin: case BuiltinType::kAsin:
@ -350,7 +351,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Builtin_Call) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "dot(param1, param2)"); EXPECT_EQ(out.str(), "dot(param1, param2)");
} }
@ -363,7 +364,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Select_Scalar) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "(true ? b : a)"); EXPECT_EQ(out.str(), "(true ? b : a)");
} }
@ -376,7 +377,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Select_Vector) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "mix(a, b, bvec2(true, false))"); EXPECT_EQ(out.str(), "mix(a, b, bvec2(true, false))");
} }
@ -393,7 +394,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, FMA_f32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "((a) * (b) + (c))"); EXPECT_EQ(out.str(), "((a) * (b) + (c))");
} }
@ -411,7 +412,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, FMA_f16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "((a) * (b) + (c))"); EXPECT_EQ(out.str(), "((a) * (b) + (c))");
} }
@ -931,7 +932,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f32) {
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -959,7 +960,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f32) {
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
vec3 tint_degrees(vec3 param_0) { vec3 tint_degrees(vec3 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -990,7 +991,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_degrees(float16_t param_0) { float16_t tint_degrees(float16_t param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -1021,7 +1022,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f16) {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_degrees(f16vec3 param_0) { f16vec3 tint_degrees(f16vec3 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -1049,7 +1050,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f32) {
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -1077,7 +1078,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f32) {
EXPECT_EQ(gen.result(), R"(#version 310 es EXPECT_EQ(gen.result(), R"(#version 310 es
vec3 tint_radians(vec3 param_0) { vec3 tint_radians(vec3 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -1108,7 +1109,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f16) {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_radians(float16_t param_0) { float16_t tint_radians(float16_t param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -1139,7 +1140,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f16) {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_radians(f16vec3 param_0) { f16vec3 tint_radians(f16vec3 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }

View File

@ -13,6 +13,7 @@
// limitations under the License. // limitations under the License.
#include "src/tint/ast/call_statement.h" #include "src/tint/ast/call_statement.h"
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
using namespace tint::number_suffixes; // NOLINT using namespace tint::number_suffixes; // NOLINT
@ -30,7 +31,7 @@ TEST_F(GlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "my_func()"); EXPECT_EQ(out.str(), "my_func()");
} }
@ -50,7 +51,7 @@ TEST_F(GlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "my_func(param1, param2)"); EXPECT_EQ(out.str(), "my_func(param1, param2)");
} }

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
using namespace tint::number_suffixes; // NOLINT using namespace tint::number_suffixes; // NOLINT
@ -27,7 +28,7 @@ TEST_F(GlslGeneratorImplTest_Cast, EmitExpression_Cast_Scalar) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error();
EXPECT_EQ(out.str(), "1.0f"); EXPECT_EQ(out.str(), "1.0f");
} }
@ -38,7 +39,7 @@ TEST_F(GlslGeneratorImplTest_Cast, EmitExpression_Cast_Vector) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, cast)) << gen.error();
EXPECT_EQ(out.str(), "vec3(1.0f, 2.0f, 3.0f)"); EXPECT_EQ(out.str(), "vec3(1.0f, 2.0f, 3.0f)");
} }

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
namespace tint::writer::glsl { namespace tint::writer::glsl {
@ -27,7 +28,7 @@ TEST_F(GlslGeneratorImplTest_Identifier, EmitIdentifierExpression) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, i)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, i)) << gen.error();
EXPECT_EQ(out.str(), "foo"); EXPECT_EQ(out.str(), "foo");
} }

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
using namespace tint::number_suffixes; // NOLINT using namespace tint::number_suffixes; // NOLINT
@ -39,7 +40,7 @@ TEST_P(GlslImportData_SingleParamTest, FloatScalar) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f)"); EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f)");
} }
@ -78,7 +79,7 @@ TEST_P(GlslImportData_SingleIntParamTest, IntScalar) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1)"); EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1)");
} }
@ -95,7 +96,7 @@ TEST_P(GlslImportData_SingleVectorParamTest, FloatVector) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), EXPECT_EQ(out.str(),
std::string(param.glsl_name) + "(vec3(0.100000001f, 0.200000003f, 0.300000012f))"); std::string(param.glsl_name) + "(vec3(0.100000001f, 0.200000003f, 0.300000012f))");
@ -136,7 +137,7 @@ TEST_P(GlslImportData_DualParam_ScalarTest, Float) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f, 2.0f)"); EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f, 2.0f)");
} }
@ -158,7 +159,7 @@ TEST_P(GlslImportData_DualParam_VectorTest, Float) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), EXPECT_EQ(out.str(),
std::string(param.glsl_name) + "(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f))"); std::string(param.glsl_name) + "(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f))");
@ -183,7 +184,7 @@ TEST_P(GlslImportData_DualParam_Int_Test, IntScalar) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1, 2)"); EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1, 2)");
} }
@ -201,7 +202,7 @@ TEST_P(GlslImportData_TripleParam_ScalarTest, Float) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f, 2.0f, 3.0f)"); EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1.0f, 2.0f, 3.0f)");
} }
@ -221,7 +222,7 @@ TEST_P(GlslImportData_TripleParam_VectorTest, Float) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), EXPECT_EQ(out.str(),
std::string(param.glsl_name) + std::string(param.glsl_name) +
@ -242,7 +243,7 @@ TEST_P(GlslImportData_TripleParam_Int_Test, IntScalar) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1, 2, 3)"); EXPECT_EQ(out.str(), std::string(param.glsl_name) + "(1, 2, 3)");
} }
@ -258,7 +259,7 @@ TEST_F(GlslGeneratorImplTest_Import, GlslImportData_Determinant) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error(); ASSERT_TRUE(gen.EmitCall(out, expr)) << gen.error();
EXPECT_EQ(out.str(), std::string("determinant(var)")); EXPECT_EQ(out.str(), std::string("determinant(var)"));
} }

View File

@ -21,6 +21,7 @@
#include "src/tint/type/sampler.h" #include "src/tint/type/sampler.h"
#include "src/tint/type/storage_texture.h" #include "src/tint/type/storage_texture.h"
#include "src/tint/type/texture_dimension.h" #include "src/tint/type/texture_dimension.h"
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
using ::testing::HasSubstr; using ::testing::HasSubstr;
@ -38,7 +39,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Array) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary")) builtin::Access::kReadWrite, "ary"))
<< gen.error(); << gen.error();
@ -51,7 +52,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArray) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary")) builtin::Access::kReadWrite, "ary"))
<< gen.error(); << gen.error();
@ -64,7 +65,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "ary")) builtin::Access::kReadWrite, "ary"))
<< gen.error(); << gen.error();
@ -77,7 +78,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Array_WithoutName) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, program->TypeOf(ty), builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -89,7 +90,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Bool) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, bool_, builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, bool_, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -101,7 +102,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_F32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, f32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, f32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -115,7 +116,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_F16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, f16, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, f16, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -127,7 +128,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_I32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, i32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, i32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -141,7 +142,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -157,7 +158,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, mat2x3, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -194,7 +195,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Struct) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
auto* sem_s = program->TypeOf(s)->As<sem::Struct>(); auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, sem_s, builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, sem_s, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -243,7 +244,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_U32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, u32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, u32, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -256,7 +257,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F32) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -271,7 +272,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F16) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, vec3, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -283,7 +284,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Void) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitType(out, void_, builtin::AddressSpace::kUndefined, ASSERT_TRUE(gen.EmitType(out, void_, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -295,7 +296,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitSampler) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_FALSE(gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined, ASSERT_FALSE(gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -306,7 +307,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitSamplerComparison) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_FALSE(gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined, ASSERT_FALSE(gen.EmitType(out, sampler, builtin::AddressSpace::kUndefined,
builtin::Access::kReadWrite, "")) builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();
@ -513,7 +514,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitMultisampledTexture) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE( ASSERT_TRUE(
gen.EmitType(out, s, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, "")) gen.EmitType(out, s, builtin::AddressSpace::kUndefined, builtin::Access::kReadWrite, ""))
<< gen.error(); << gen.error();

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "src/tint/utils/string_stream.h"
#include "src/tint/writer/glsl/test_helper.h" #include "src/tint/writer/glsl/test_helper.h"
namespace tint::writer::glsl { namespace tint::writer::glsl {
@ -26,7 +27,7 @@ TEST_F(GlslUnaryOpTest, AddressOf) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error();
EXPECT_EQ(out.str(), "expr"); EXPECT_EQ(out.str(), "expr");
} }
@ -38,7 +39,7 @@ TEST_F(GlslUnaryOpTest, Complement) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error();
EXPECT_EQ(out.str(), "~(expr)"); EXPECT_EQ(out.str(), "~(expr)");
} }
@ -51,7 +52,7 @@ TEST_F(GlslUnaryOpTest, Indirection) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error();
EXPECT_EQ(out.str(), "expr"); EXPECT_EQ(out.str(), "expr");
} }
@ -63,7 +64,7 @@ TEST_F(GlslUnaryOpTest, Not) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error();
EXPECT_EQ(out.str(), "!(expr)"); EXPECT_EQ(out.str(), "!(expr)");
} }
@ -75,7 +76,7 @@ TEST_F(GlslUnaryOpTest, Negation) {
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
std::stringstream out; utils::StringStream out;
ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, op)) << gen.error();
EXPECT_EQ(out.str(), "-(expr)"); EXPECT_EQ(out.str(), "-(expr)");
} }

View File

@ -811,7 +811,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f32) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(float tint_degrees(float param_0) { EXPECT_EQ(gen.result(), R"(float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -832,7 +832,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f32) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(float3 tint_degrees(float3 param_0) { EXPECT_EQ(gen.result(), R"(float3 tint_degrees(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -855,7 +855,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(float16_t tint_degrees(float16_t param_0) { EXPECT_EQ(gen.result(), R"(float16_t tint_degrees(float16_t param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -878,7 +878,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f16) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(vector<float16_t, 3> tint_degrees(vector<float16_t, 3> param_0) { EXPECT_EQ(gen.result(), R"(vector<float16_t, 3> tint_degrees(vector<float16_t, 3> param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -899,7 +899,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f32) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(float tint_radians(float param_0) { EXPECT_EQ(gen.result(), R"(float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -920,7 +920,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f32) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(float3 tint_radians(float3 param_0) { EXPECT_EQ(gen.result(), R"(float3 tint_radians(float3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -943,7 +943,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f16) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(float16_t tint_radians(float16_t param_0) { EXPECT_EQ(gen.result(), R"(float16_t tint_radians(float16_t param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -966,7 +966,7 @@ TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f16) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_EQ(gen.result(), R"(vector<float16_t, 3> tint_radians(vector<float16_t, 3> param_0) { EXPECT_EQ(gen.result(), R"(vector<float16_t, 3> tint_radians(vector<float16_t, 3> param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -850,7 +850,7 @@ TEST_F(MslGeneratorImplTest, Degrees_Scalar_f32) {
using namespace metal; using namespace metal;
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
kernel void test_function() { kernel void test_function() {
@ -875,7 +875,7 @@ TEST_F(MslGeneratorImplTest, Degrees_Vector_f32) {
using namespace metal; using namespace metal;
float3 tint_degrees(float3 param_0) { float3 tint_degrees(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
kernel void test_function() { kernel void test_function() {
@ -902,7 +902,7 @@ TEST_F(MslGeneratorImplTest, Degrees_Scalar_f16) {
using namespace metal; using namespace metal;
half tint_degrees(half param_0) { half tint_degrees(half param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
kernel void test_function() { kernel void test_function() {
@ -929,7 +929,7 @@ TEST_F(MslGeneratorImplTest, Degrees_Vector_f16) {
using namespace metal; using namespace metal;
half3 tint_degrees(half3 param_0) { half3 tint_degrees(half3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
kernel void test_function() { kernel void test_function() {
@ -954,7 +954,7 @@ TEST_F(MslGeneratorImplTest, Radians_Scalar_f32) {
using namespace metal; using namespace metal;
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
kernel void test_function() { kernel void test_function() {
@ -979,7 +979,7 @@ TEST_F(MslGeneratorImplTest, Radians_Vector_f32) {
using namespace metal; using namespace metal;
float3 tint_radians(float3 param_0) { float3 tint_radians(float3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
kernel void test_function() { kernel void test_function() {
@ -1006,7 +1006,7 @@ TEST_F(MslGeneratorImplTest, Radians_Scalar_f16) {
using namespace metal; using namespace metal;
half tint_radians(half param_0) { half tint_radians(half param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
kernel void test_function() { kernel void test_function() {
@ -1033,7 +1033,7 @@ TEST_F(MslGeneratorImplTest, Radians_Vector_f16) {
using namespace metal; using namespace metal;
half3 tint_radians(half3 param_0) { half3 tint_radians(half3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
kernel void test_function() { kernel void test_function() {

View File

@ -130,6 +130,7 @@ std::string TextGenerator::TextBuffer::String(uint32_t indent /* = 0 */) const {
TextGenerator::ScopedParen::ScopedParen(std::ostream& stream) : s(stream) { TextGenerator::ScopedParen::ScopedParen(std::ostream& stream) : s(stream) {
s << "("; s << "(";
} }
TextGenerator::ScopedParen::~ScopedParen() { TextGenerator::ScopedParen::~ScopedParen() {
s << ")"; s << ")";
} }

View File

@ -23,6 +23,7 @@
#include "src/tint/diagnostic/diagnostic.h" #include "src/tint/diagnostic/diagnostic.h"
#include "src/tint/program_builder.h" #include "src/tint/program_builder.h"
#include "src/tint/utils/string_stream.h"
namespace tint::writer { namespace tint::writer {
@ -139,13 +140,16 @@ class TextGenerator {
/// Destructor /// Destructor
~LineWriter(); ~LineWriter();
/// @returns the ostringstream /// [DEPRECATED] Remove when utils::StringStream conversion is done
operator std::ostream&() { return os; } /// @returns the utils::StringStream
operator std::ostream&() { return os.stream(); }
/// @returns the utils::StringStream
operator utils::StringStream&() { return os; }
/// @param rhs the value to write to the line /// @param rhs the value to write to the line
/// @returns the ostream so calls can be chained /// @returns the utils::StringStream so calls can be chained
template <typename T> template <typename T>
std::ostream& operator<<(T&& rhs) { utils::StringStream& operator<<(T&& rhs) {
return os << std::forward<T>(rhs); return os << std::forward<T>(rhs);
} }
@ -153,13 +157,14 @@ class TextGenerator {
LineWriter(const LineWriter&) = delete; LineWriter(const LineWriter&) = delete;
LineWriter& operator=(const LineWriter&) = delete; LineWriter& operator=(const LineWriter&) = delete;
std::ostringstream os; utils::StringStream os;
TextBuffer* buffer; TextBuffer* buffer;
}; };
/// Helper for writing a '(' on construction and a ')' destruction. /// Helper for writing a '(' on construction and a ')' destruction.
struct ScopedParen { struct ScopedParen {
/// Constructor /// Constructor
/// [DEPRECATED] This should be utils::StringStream when conversion is done
/// @param stream the std::ostream that will be written to /// @param stream the std::ostream that will be written to
explicit ScopedParen(std::ostream& stream); explicit ScopedParen(std::ostream& stream);
/// Destructor /// Destructor

View File

@ -1,5 +1,5 @@
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void main_1() { void main_1() {

View File

@ -1,5 +1,5 @@
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void main_1() { void main_1() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void main_1() { void main_1() {

View File

@ -1,5 +1,5 @@
float4 tint_degrees(float4 param_0) { float4 tint_degrees(float4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_0d170c() { void degrees_0d170c() {

View File

@ -1,5 +1,5 @@
float4 tint_degrees(float4 param_0) { float4 tint_degrees(float4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_0d170c() { void degrees_0d170c() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
vec4 tint_degrees(vec4 param_0) { vec4 tint_degrees(vec4 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
vec4 tint_degrees(vec4 param_0) { vec4 tint_degrees(vec4 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
vec4 tint_degrees(vec4 param_0) { vec4 tint_degrees(vec4 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float4 tint_degrees(float4 param_0) { float4 tint_degrees(float4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_0d170c() { void degrees_0d170c() {

View File

@ -1,5 +1,5 @@
float2 tint_degrees(float2 param_0) { float2 tint_degrees(float2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_1ad5df() { void degrees_1ad5df() {

View File

@ -1,5 +1,5 @@
float2 tint_degrees(float2 param_0) { float2 tint_degrees(float2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_1ad5df() { void degrees_1ad5df() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
vec2 tint_degrees(vec2 param_0) { vec2 tint_degrees(vec2 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
vec2 tint_degrees(vec2 param_0) { vec2 tint_degrees(vec2 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
vec2 tint_degrees(vec2 param_0) { vec2 tint_degrees(vec2 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float2 tint_degrees(float2 param_0) { float2 tint_degrees(float2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_1ad5df() { void degrees_1ad5df() {

View File

@ -1,5 +1,5 @@
float3 tint_degrees(float3 param_0) { float3 tint_degrees(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_2af623() { void degrees_2af623() {

View File

@ -1,5 +1,5 @@
float3 tint_degrees(float3 param_0) { float3 tint_degrees(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_2af623() { void degrees_2af623() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
vec3 tint_degrees(vec3 param_0) { vec3 tint_degrees(vec3 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
vec3 tint_degrees(vec3 param_0) { vec3 tint_degrees(vec3 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
vec3 tint_degrees(vec3 param_0) { vec3 tint_degrees(vec3 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float3 tint_degrees(float3 param_0) { float3 tint_degrees(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_2af623() { void degrees_2af623() {

View File

@ -1,5 +1,5 @@
vector<float16_t, 4> tint_degrees(vector<float16_t, 4> param_0) { vector<float16_t, 4> tint_degrees(vector<float16_t, 4> param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_3055d3() { void degrees_3055d3() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec4 tint_degrees(f16vec4 param_0) { f16vec4 tint_degrees(f16vec4 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
f16vec4 tint_degrees(f16vec4 param_0) { f16vec4 tint_degrees(f16vec4 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec4 tint_degrees(f16vec4 param_0) { f16vec4 tint_degrees(f16vec4 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half4 tint_degrees(half4 param_0) { half4 tint_degrees(half4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_3055d3() { void degrees_3055d3() {

View File

@ -1,5 +1,5 @@
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_51f705() { void degrees_51f705() {

View File

@ -1,5 +1,5 @@
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_51f705() { void degrees_51f705() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float tint_degrees(float param_0) { float tint_degrees(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_51f705() { void degrees_51f705() {

View File

@ -1,5 +1,5 @@
float16_t tint_degrees(float16_t param_0) { float16_t tint_degrees(float16_t param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_5e9805() { void degrees_5e9805() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_degrees(float16_t param_0) { float16_t tint_degrees(float16_t param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
float16_t tint_degrees(float16_t param_0) { float16_t tint_degrees(float16_t param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_degrees(float16_t param_0) { float16_t tint_degrees(float16_t param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half tint_degrees(half param_0) { half tint_degrees(half param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_5e9805() { void degrees_5e9805() {

View File

@ -1,5 +1,5 @@
vector<float16_t, 3> tint_degrees(vector<float16_t, 3> param_0) { vector<float16_t, 3> tint_degrees(vector<float16_t, 3> param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_dfe8f4() { void degrees_dfe8f4() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_degrees(f16vec3 param_0) { f16vec3 tint_degrees(f16vec3 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
f16vec3 tint_degrees(f16vec3 param_0) { f16vec3 tint_degrees(f16vec3 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_degrees(f16vec3 param_0) { f16vec3 tint_degrees(f16vec3 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half3 tint_degrees(half3 param_0) { half3 tint_degrees(half3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_dfe8f4() { void degrees_dfe8f4() {

View File

@ -1,5 +1,5 @@
vector<float16_t, 2> tint_degrees(vector<float16_t, 2> param_0) { vector<float16_t, 2> tint_degrees(vector<float16_t, 2> param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_f59715() { void degrees_f59715() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec2 tint_degrees(f16vec2 param_0) { f16vec2 tint_degrees(f16vec2 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
f16vec2 tint_degrees(f16vec2 param_0) { f16vec2 tint_degrees(f16vec2 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec2 tint_degrees(f16vec2 param_0) { f16vec2 tint_degrees(f16vec2 param_0) {
return param_0 * 57.295779513082322865hf; return param_0 * 57.295779513082323hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half2 tint_degrees(half2 param_0) { half2 tint_degrees(half2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
void degrees_f59715() { void degrees_f59715() {

View File

@ -1,5 +1,5 @@
float4 tint_radians(float4 param_0) { float4 tint_radians(float4 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_09b7fc() { void radians_09b7fc() {

View File

@ -1,5 +1,5 @@
float4 tint_radians(float4 param_0) { float4 tint_radians(float4 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_09b7fc() { void radians_09b7fc() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
vec4 tint_radians(vec4 param_0) { vec4 tint_radians(vec4 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
vec4 tint_radians(vec4 param_0) { vec4 tint_radians(vec4 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
vec4 tint_radians(vec4 param_0) { vec4 tint_radians(vec4 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float4 tint_radians(float4 param_0) { float4 tint_radians(float4 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_09b7fc() { void radians_09b7fc() {

View File

@ -1,5 +1,5 @@
float16_t tint_radians(float16_t param_0) { float16_t tint_radians(float16_t param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_208fd9() { void radians_208fd9() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_radians(float16_t param_0) { float16_t tint_radians(float16_t param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
float16_t tint_radians(float16_t param_0) { float16_t tint_radians(float16_t param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_radians(float16_t param_0) { float16_t tint_radians(float16_t param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half tint_radians(half param_0) { half tint_radians(half param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_208fd9() { void radians_208fd9() {

View File

@ -1,5 +1,5 @@
vector<float16_t, 4> tint_radians(vector<float16_t, 4> param_0) { vector<float16_t, 4> tint_radians(vector<float16_t, 4> param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_44f20b() { void radians_44f20b() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec4 tint_radians(f16vec4 param_0) { f16vec4 tint_radians(f16vec4 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
f16vec4 tint_radians(f16vec4 param_0) { f16vec4 tint_radians(f16vec4 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec4 tint_radians(f16vec4 param_0) { f16vec4 tint_radians(f16vec4 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half4 tint_radians(half4 param_0) { half4 tint_radians(half4 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_44f20b() { void radians_44f20b() {

View File

@ -1,5 +1,5 @@
float2 tint_radians(float2 param_0) { float2 tint_radians(float2 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_61687a() { void radians_61687a() {

View File

@ -1,5 +1,5 @@
float2 tint_radians(float2 param_0) { float2 tint_radians(float2 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_61687a() { void radians_61687a() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
vec2 tint_radians(vec2 param_0) { vec2 tint_radians(vec2 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
vec2 tint_radians(vec2 param_0) { vec2 tint_radians(vec2 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
vec2 tint_radians(vec2 param_0) { vec2 tint_radians(vec2 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float2 tint_radians(float2 param_0) { float2 tint_radians(float2 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_61687a() { void radians_61687a() {

View File

@ -1,5 +1,5 @@
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_6b0ff2() { void radians_6b0ff2() {

View File

@ -1,5 +1,5 @@
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_6b0ff2() { void radians_6b0ff2() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_6b0ff2() { void radians_6b0ff2() {

View File

@ -1,5 +1,5 @@
vector<float16_t, 3> tint_radians(vector<float16_t, 3> param_0) { vector<float16_t, 3> tint_radians(vector<float16_t, 3> param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_7ea4c7() { void radians_7ea4c7() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_radians(f16vec3 param_0) { f16vec3 tint_radians(f16vec3 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
f16vec3 tint_radians(f16vec3 param_0) { f16vec3 tint_radians(f16vec3 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_radians(f16vec3 param_0) { f16vec3 tint_radians(f16vec3 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half3 tint_radians(half3 param_0) { half3 tint_radians(half3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_7ea4c7() { void radians_7ea4c7() {

View File

@ -1,5 +1,5 @@
float3 tint_radians(float3 param_0) { float3 tint_radians(float3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_f96258() { void radians_f96258() {

View File

@ -1,5 +1,5 @@
float3 tint_radians(float3 param_0) { float3 tint_radians(float3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_f96258() { void radians_f96258() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
vec3 tint_radians(vec3 param_0) { vec3 tint_radians(vec3 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -27,7 +27,7 @@ void main() {
precision mediump float; precision mediump float;
vec3 tint_radians(vec3 param_0) { vec3 tint_radians(vec3 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }
@ -47,7 +47,7 @@ void main() {
#version 310 es #version 310 es
vec3 tint_radians(vec3 param_0) { vec3 tint_radians(vec3 param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float3 tint_radians(float3 param_0) { float3 tint_radians(float3 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_f96258() { void radians_f96258() {

View File

@ -1,5 +1,5 @@
vector<float16_t, 2> tint_radians(vector<float16_t, 2> param_0) { vector<float16_t, 2> tint_radians(vector<float16_t, 2> param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_fbacf0() { void radians_fbacf0() {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec2 tint_radians(f16vec2 param_0) { f16vec2 tint_radians(f16vec2 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -29,7 +29,7 @@ void main() {
precision mediump float; precision mediump float;
f16vec2 tint_radians(f16vec2 param_0) { f16vec2 tint_radians(f16vec2 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }
@ -50,7 +50,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec2 tint_radians(f16vec2 param_0) { f16vec2 tint_radians(f16vec2 param_0) {
return param_0 * 0.017453292519943295474hf; return param_0 * 0.017453292519943295hf;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
half2 tint_radians(half2 param_0) { half2 tint_radians(half2 param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void radians_fbacf0() { void radians_fbacf0() {

View File

@ -1,5 +1,5 @@
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void main_1() { void main_1() {

View File

@ -1,5 +1,5 @@
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void main_1() { void main_1() {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474f; return param_0 * 0.017453292519943295f;
} }

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
float tint_radians(float param_0) { float tint_radians(float param_0) {
return param_0 * 0.017453292519943295474; return param_0 * 0.017453292519943295;
} }
void main_1() { void main_1() {

View File

@ -1,17 +1,17 @@
float4 tint_degrees(float4 param_0) { float4 tint_degrees(float4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float3 tint_degrees_1(float3 param_0) { float3 tint_degrees_1(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float2 tint_degrees_2(float2 param_0) { float2 tint_degrees_2(float2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float tint_degrees_3(float param_0) { float tint_degrees_3(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -1,17 +1,17 @@
float4 tint_degrees(float4 param_0) { float4 tint_degrees(float4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float3 tint_degrees_1(float3 param_0) { float3 tint_degrees_1(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float2 tint_degrees_2(float2 param_0) { float2 tint_degrees_2(float2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float tint_degrees_3(float param_0) { float tint_degrees_3(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -1,19 +1,19 @@
#version 310 es #version 310 es
vec4 tint_degrees(vec4 param_0) { vec4 tint_degrees(vec4 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
vec3 tint_degrees_1(vec3 param_0) { vec3 tint_degrees_1(vec3 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
vec2 tint_degrees_2(vec2 param_0) { vec2 tint_degrees_2(vec2 param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }
float tint_degrees_3(float param_0) { float tint_degrees_3(float param_0) {
return param_0 * 57.295779513082322865f; return param_0 * 57.295779513082323f;
} }

View File

@ -3,19 +3,19 @@
using namespace metal; using namespace metal;
float4 tint_degrees(float4 param_0) { float4 tint_degrees(float4 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float3 tint_degrees_1(float3 param_0) { float3 tint_degrees_1(float3 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float2 tint_degrees_2(float2 param_0) { float2 tint_degrees_2(float2 param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
float tint_degrees_3(float param_0) { float tint_degrees_3(float param_0) {
return param_0 * 57.295779513082322865; return param_0 * 57.295779513082323;
} }
kernel void tint_symbol() { kernel void tint_symbol() {