More GLSL fixes.
Remove register-and-space decoration. Add "main" to GLSL keywords, to force renaming. Output correct compute width decoration (not numthreads). Remove static keyword. Bug: tint:1218 tint:1219 tint:1220 Change-Id: I171f183690b6531c76218414e0d81f6ef5e22e6b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66340 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
7cf3b28a87
commit
2f963aaf82
|
@ -136,6 +136,7 @@ const char* kReservedKeywordsGLSL[] = {
|
||||||
"layout",
|
"layout",
|
||||||
"long",
|
"long",
|
||||||
"lowp",
|
"lowp",
|
||||||
|
"main",
|
||||||
"mat2",
|
"mat2",
|
||||||
"mat2x2",
|
"mat2x2",
|
||||||
"mat2x3",
|
"mat2x3",
|
||||||
|
|
|
@ -93,22 +93,6 @@ const char* image_format_to_rwtexture_type(ast::ImageFormat image_format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for writing " : register(RX, spaceY)", where R is the register, X is
|
|
||||||
// the binding point binding value, and Y is the binding point group value.
|
|
||||||
struct RegisterAndSpace {
|
|
||||||
RegisterAndSpace(char r, ast::Variable::BindingPoint bp)
|
|
||||||
: reg(r), binding_point(bp) {}
|
|
||||||
|
|
||||||
char const reg;
|
|
||||||
ast::Variable::BindingPoint const binding_point;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& s, const RegisterAndSpace& rs) {
|
|
||||||
s << " : register(" << rs.reg << rs.binding_point.binding->value()
|
|
||||||
<< ", space" << rs.binding_point.group->value() << ")";
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
GeneratorImpl::GeneratorImpl(const Program* program) : TextGenerator(program) {}
|
GeneratorImpl::GeneratorImpl(const Program* program) : TextGenerator(program) {}
|
||||||
|
@ -1591,16 +1575,13 @@ bool GeneratorImpl::EmitStorageVariable(const sem::Variable* var) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << RegisterAndSpace(var->Access() == ast::Access::kRead ? 't' : 'u',
|
out << ";";
|
||||||
decl->binding_point())
|
|
||||||
<< ";";
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) {
|
bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) {
|
||||||
auto* decl = var->Declaration();
|
auto* decl = var->Declaration();
|
||||||
auto* unwrapped_type = var->Type()->UnwrapRef();
|
|
||||||
auto out = line();
|
auto out = line();
|
||||||
|
|
||||||
auto name = builder_.Symbols().NameFor(decl->symbol());
|
auto name = builder_.Symbols().NameFor(decl->symbol());
|
||||||
|
@ -1609,25 +1590,6 @@ bool GeneratorImpl::EmitHandleVariable(const sem::Variable* var) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* register_space = nullptr;
|
|
||||||
|
|
||||||
if (unwrapped_type->Is<sem::Texture>()) {
|
|
||||||
register_space = "t";
|
|
||||||
if (auto* storage_tex = unwrapped_type->As<sem::StorageTexture>()) {
|
|
||||||
if (storage_tex->access() != ast::Access::kRead) {
|
|
||||||
register_space = "u";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (unwrapped_type->Is<sem::Sampler>()) {
|
|
||||||
register_space = "s";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (register_space) {
|
|
||||||
auto bp = decl->binding_point();
|
|
||||||
out << " : register(" << register_space << bp.binding->value() << ", space"
|
|
||||||
<< bp.group->value() << ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
out << ";";
|
out << ";";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1636,8 +1598,6 @@ bool GeneratorImpl::EmitPrivateVariable(const sem::Variable* var) {
|
||||||
auto* decl = var->Declaration();
|
auto* decl = var->Declaration();
|
||||||
auto out = line();
|
auto out = line();
|
||||||
|
|
||||||
out << "static ";
|
|
||||||
|
|
||||||
auto name = builder_.Symbols().NameFor(decl->symbol());
|
auto name = builder_.Symbols().NameFor(decl->symbol());
|
||||||
auto* type = var->Type()->UnwrapRef();
|
auto* type = var->Type()->UnwrapRef();
|
||||||
if (!EmitTypeAndName(out, type, var->StorageClass(), var->Access(), name)) {
|
if (!EmitTypeAndName(out, type, var->StorageClass(), var->Access(), name)) {
|
||||||
|
@ -1778,13 +1738,14 @@ bool GeneratorImpl::EmitEntryPointFunction(ast::Function* func) {
|
||||||
{
|
{
|
||||||
auto out = line();
|
auto out = line();
|
||||||
if (func->pipeline_stage() == ast::PipelineStage::kCompute) {
|
if (func->pipeline_stage() == ast::PipelineStage::kCompute) {
|
||||||
// Emit the workgroup_size attribute.
|
// Emit the layout(local_size) attributes.
|
||||||
auto wgsize = func_sem->workgroup_size();
|
auto wgsize = func_sem->workgroup_size();
|
||||||
out << "[numthreads(";
|
out << "layout(";
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
out << ", ";
|
out << ", ";
|
||||||
}
|
}
|
||||||
|
out << "local_size_" << (i == 0 ? "x" : i == 1 ? "y" : "z") << " = ";
|
||||||
|
|
||||||
if (wgsize[i].overridable_const) {
|
if (wgsize[i].overridable_const) {
|
||||||
auto* global = builder_.Sem().Get<sem::GlobalVariable>(
|
auto* global = builder_.Sem().Get<sem::GlobalVariable>(
|
||||||
|
@ -1798,7 +1759,7 @@ bool GeneratorImpl::EmitEntryPointFunction(ast::Function* func) {
|
||||||
out << std::to_string(wgsize[i].value);
|
out << std::to_string(wgsize[i].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out << ")]" << std::endl;
|
out << ") in;" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << func->return_type()->FriendlyName(builder_.Symbols());
|
out << func->return_type()->FriendlyName(builder_.Symbols());
|
||||||
|
@ -2641,7 +2602,7 @@ bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) {
|
||||||
line() << "#endif";
|
line() << "#endif";
|
||||||
{
|
{
|
||||||
auto out = line();
|
auto out = line();
|
||||||
out << "static const ";
|
out << "const ";
|
||||||
if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(),
|
if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(),
|
||||||
builder_.Symbols().NameFor(var->symbol()))) {
|
builder_.Symbols().NameFor(var->symbol()))) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2650,7 +2611,7 @@ bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto out = line();
|
auto out = line();
|
||||||
out << "static const ";
|
out << "const ";
|
||||||
if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(),
|
if (!EmitTypeAndName(out, type, sem->StorageClass(), sem->Access(),
|
||||||
builder_.Symbols().NameFor(var->symbol()))) {
|
builder_.Symbols().NameFor(var->symbol()))) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -537,7 +537,7 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data coord : register(u0, space1);
|
Data coord;
|
||||||
|
|
||||||
void frag_main() {
|
void frag_main() {
|
||||||
float v = coord.b;
|
float v = coord.b;
|
||||||
|
@ -586,7 +586,7 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data coord : register(t0, space1);
|
Data coord;
|
||||||
|
|
||||||
void frag_main() {
|
void frag_main() {
|
||||||
float v = coord.b;
|
float v = coord.b;
|
||||||
|
@ -631,7 +631,7 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data coord : register(u0, space1);
|
Data coord;
|
||||||
|
|
||||||
void frag_main() {
|
void frag_main() {
|
||||||
coord.b = 2.0f;
|
coord.b = 2.0f;
|
||||||
|
@ -677,7 +677,7 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data coord : register(u0, space1);
|
Data coord;
|
||||||
|
|
||||||
void frag_main() {
|
void frag_main() {
|
||||||
coord.b = 2.0f;
|
coord.b = 2.0f;
|
||||||
|
@ -782,7 +782,7 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
S coord : register(u0, space1);
|
S coord;
|
||||||
|
|
||||||
float sub_func(float param) {
|
float sub_func(float param) {
|
||||||
return coord.x;
|
return coord.x;
|
||||||
|
@ -837,7 +837,7 @@ TEST_F(GlslGeneratorImplTest_Function, Emit_Decoration_EntryPoint_Compute) {
|
||||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void main() {
|
void main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -863,7 +863,7 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
[numthreads(2, 4, 6)]
|
layout(local_size_x = 2, local_size_y = 4, local_size_z = 6) in;
|
||||||
void main() {
|
void main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -892,11 +892,11 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
EXPECT_EQ(gen.result(), R"(#version 310 es
|
EXPECT_EQ(gen.result(), R"(#version 310 es
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
static const int width = int(2);
|
const int width = int(2);
|
||||||
static const int height = int(3);
|
const int height = int(3);
|
||||||
static const int depth = int(4);
|
const int depth = int(4);
|
||||||
|
|
||||||
[numthreads(2, 3, 4)]
|
layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in;
|
||||||
void main() {
|
void main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -928,17 +928,17 @@ precision mediump float;
|
||||||
#ifndef WGSL_SPEC_CONSTANT_7
|
#ifndef WGSL_SPEC_CONSTANT_7
|
||||||
#define WGSL_SPEC_CONSTANT_7 int(2)
|
#define WGSL_SPEC_CONSTANT_7 int(2)
|
||||||
#endif
|
#endif
|
||||||
static const int width = WGSL_SPEC_CONSTANT_7;
|
const int width = WGSL_SPEC_CONSTANT_7;
|
||||||
#ifndef WGSL_SPEC_CONSTANT_8
|
#ifndef WGSL_SPEC_CONSTANT_8
|
||||||
#define WGSL_SPEC_CONSTANT_8 int(3)
|
#define WGSL_SPEC_CONSTANT_8 int(3)
|
||||||
#endif
|
#endif
|
||||||
static const int height = WGSL_SPEC_CONSTANT_8;
|
const int height = WGSL_SPEC_CONSTANT_8;
|
||||||
#ifndef WGSL_SPEC_CONSTANT_9
|
#ifndef WGSL_SPEC_CONSTANT_9
|
||||||
#define WGSL_SPEC_CONSTANT_9 int(4)
|
#define WGSL_SPEC_CONSTANT_9 int(4)
|
||||||
#endif
|
#endif
|
||||||
static const int depth = WGSL_SPEC_CONSTANT_9;
|
const int depth = WGSL_SPEC_CONSTANT_9;
|
||||||
|
|
||||||
[numthreads(WGSL_SPEC_CONSTANT_7, WGSL_SPEC_CONSTANT_8, WGSL_SPEC_CONSTANT_9)]
|
layout(local_size_x = WGSL_SPEC_CONSTANT_7, local_size_y = WGSL_SPEC_CONSTANT_8, local_size_z = WGSL_SPEC_CONSTANT_9) in;
|
||||||
void main() {
|
void main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1047,9 +1047,9 @@ TEST_F(GlslGeneratorImplTest_Function,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space0);
|
Data data;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void a() {
|
void a() {
|
||||||
float v = data.d;
|
float v = data.d;
|
||||||
return;
|
return;
|
||||||
|
@ -1060,7 +1060,7 @@ void main() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void b() {
|
void b() {
|
||||||
float v = data.d;
|
float v = data.d;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -545,7 +545,7 @@ TEST_F(GlslGeneratorImplTest_Intrinsic, StorageBarrier) {
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
EXPECT_EQ(gen.result(), R"(layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void main() {
|
void main() {
|
||||||
DeviceMemoryBarrierWithGroupSync();
|
DeviceMemoryBarrierWithGroupSync();
|
||||||
return;
|
return;
|
||||||
|
@ -564,7 +564,7 @@ TEST_F(GlslGeneratorImplTest_Intrinsic, WorkgroupBarrier) {
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_EQ(gen.result(), R"([numthreads(1, 1, 1)]
|
EXPECT_EQ(gen.result(), R"(layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void main() {
|
void main() {
|
||||||
GroupMemoryBarrierWithGroupSync();
|
GroupMemoryBarrierWithGroupSync();
|
||||||
return;
|
return;
|
||||||
|
@ -590,7 +590,7 @@ TEST_F(GlslGeneratorImplTest_Intrinsic, Ignore) {
|
||||||
return ((a + b) * c);
|
return ((a + b) * c);
|
||||||
}
|
}
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void main() {
|
void main() {
|
||||||
f(1, 2, 3);
|
f(1, 2, 3);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -139,9 +139,9 @@ struct Data {
|
||||||
float mem;
|
float mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Data str = Data(0.0f);
|
Data str = Data(0.0f);
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
void test_function() {
|
void test_function() {
|
||||||
float expr = str.mem;
|
float expr = str.mem;
|
||||||
return;
|
return;
|
||||||
|
@ -297,14 +297,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_Matrix_Empty) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
data.b = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
data.b = mat2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -340,14 +340,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
float x = data.a[2][1];
|
float x = data.a[2][1];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -381,14 +381,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
int x = data.a[2];
|
int x = data.a[2];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,14 +423,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
int x = data.a[((2 + 4) - 3)];
|
int x = data.a[((2 + 4) - 3)];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -462,14 +462,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_ToArray) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
data.a[2] = 2;
|
data.a[2] = 2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -512,14 +512,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_MultiLevel) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
vec3 x = data.c[2].b;
|
vec3 x = data.c[2].b;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -565,14 +565,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
vec2 x = data.c[2].b.xy;
|
vec2 x = data.c[2].b.xy;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -618,14 +618,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
float x = data.c[2].b.g;
|
float x = data.c[2].b.g;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -671,14 +671,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
float x = data.c[2].b[1];
|
float x = data.c[2].b[1];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -720,14 +720,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor, StorageBuffer_Store_MultiLevel) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
data.c[2].b = vec3(1.0f, 2.0f, 3.0f);
|
data.c[2].b = vec3(1.0f, 2.0f, 3.0f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -773,14 +773,14 @@ TEST_F(GlslGeneratorImplTest_MemberAccessor,
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
Data data : register(u0, space1);
|
Data data;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
data.c[2].b.y = 1.0f;
|
data.c[2].b.y = 1.0f;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,7 @@ TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_ModuleConstant) {
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error();
|
ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error();
|
||||||
EXPECT_EQ(gen.result(),
|
EXPECT_EQ(gen.result(), "const float pos[3] = float[3](1.0f, 2.0f, 3.0f);\n");
|
||||||
"static const float pos[3] = float[3](1.0f, 2.0f, 3.0f);\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) {
|
TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) {
|
||||||
|
@ -45,7 +44,7 @@ TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) {
|
||||||
EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23
|
EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23
|
||||||
#define WGSL_SPEC_CONSTANT_23 3.0f
|
#define WGSL_SPEC_CONSTANT_23 3.0f
|
||||||
#endif
|
#endif
|
||||||
static const float pos = WGSL_SPEC_CONSTANT_23;
|
const float pos = WGSL_SPEC_CONSTANT_23;
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoConstructor) {
|
||||||
EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23
|
EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_23
|
||||||
#error spec constant required for constant id 23
|
#error spec constant required for constant id 23
|
||||||
#endif
|
#endif
|
||||||
static const float pos = WGSL_SPEC_CONSTANT_23;
|
const float pos = WGSL_SPEC_CONSTANT_23;
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +81,11 @@ TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoId) {
|
||||||
EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_0
|
EXPECT_EQ(gen.result(), R"(#ifndef WGSL_SPEC_CONSTANT_0
|
||||||
#define WGSL_SPEC_CONSTANT_0 3.0f
|
#define WGSL_SPEC_CONSTANT_0 3.0f
|
||||||
#endif
|
#endif
|
||||||
static const float a = WGSL_SPEC_CONSTANT_0;
|
const float a = WGSL_SPEC_CONSTANT_0;
|
||||||
#ifndef WGSL_SPEC_CONSTANT_1
|
#ifndef WGSL_SPEC_CONSTANT_1
|
||||||
#define WGSL_SPEC_CONSTANT_1 2.0f
|
#define WGSL_SPEC_CONSTANT_1 2.0f
|
||||||
#endif
|
#endif
|
||||||
static const float b = WGSL_SPEC_CONSTANT_1;
|
const float b = WGSL_SPEC_CONSTANT_1;
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
my_struct b : register(t1, space2);
|
my_struct b;
|
||||||
|
|
||||||
void a_func() {
|
void a_func() {
|
||||||
uint tint_symbol_1 = 0u;
|
uint tint_symbol_1 = 0u;
|
||||||
|
@ -101,7 +101,7 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_OtherMembersInStruct) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
my_struct b : register(t1, space2);
|
my_struct b;
|
||||||
|
|
||||||
void a_func() {
|
void a_func() {
|
||||||
uint tint_symbol_1 = 0u;
|
uint tint_symbol_1 = 0u;
|
||||||
|
@ -152,7 +152,7 @@ TEST_F(GlslSanitizerTest, Call_ArrayLength_ViaLets) {
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
|
||||||
my_struct b : register(t1, space2);
|
my_struct b;
|
||||||
|
|
||||||
void a_func() {
|
void a_func() {
|
||||||
uint tint_symbol_1 = 0u;
|
uint tint_symbol_1 = 0u;
|
||||||
|
@ -192,13 +192,13 @@ TEST_F(GlslSanitizerTest, PromoteArrayInitializerToConstVar) {
|
||||||
auto* expect = R"(#version 310 es
|
auto* expect = R"(#version 310 es
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
int tint_symbol[4] = int[4](1, 2, 3, 4);
|
int tint_symbol_1[4] = int[4](1, 2, 3, 4);
|
||||||
int pos = tint_symbol[3];
|
int pos = tint_symbol_1[3];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,13 +239,13 @@ struct S {
|
||||||
int c;
|
int c;
|
||||||
};
|
};
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
S tint_symbol = S(1, vec3(2.0f, 3.0f, 4.0f), 4);
|
S tint_symbol_1 = S(1, vec3(2.0f, 3.0f, 4.0f), 4);
|
||||||
vec3 pos = tint_symbol.b;
|
vec3 pos = tint_symbol_1.b;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,13 +280,13 @@ TEST_F(GlslSanitizerTest, InlinePtrLetsBasic) {
|
||||||
auto* expect = R"(#version 310 es
|
auto* expect = R"(#version 310 es
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
int v = 0;
|
int v = 0;
|
||||||
int x = v;
|
int x = v;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -331,13 +331,13 @@ TEST_F(GlslSanitizerTest, InlinePtrLetsComplexChain) {
|
||||||
auto* expect = R"(#version 310 es
|
auto* expect = R"(#version 310 es
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
void main() {
|
void tint_symbol() {
|
||||||
mat4 m = mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
mat4 m = mat4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
float f = m[2][1];
|
float f = m[2][1];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void main() {
|
void main() {
|
||||||
main();
|
tint_symbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -352,14 +352,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
GlslGeneratorImplTest_Type,
|
GlslGeneratorImplTest_Type,
|
||||||
GlslDepthTexturesTest,
|
GlslDepthTexturesTest,
|
||||||
testing::Values(
|
testing::Values(
|
||||||
GlslDepthTextureData{ast::TextureDimension::k2d,
|
GlslDepthTextureData{ast::TextureDimension::k2d, "Texture2D tex;"},
|
||||||
"Texture2D tex : register(t1, space2);"},
|
|
||||||
GlslDepthTextureData{ast::TextureDimension::k2dArray,
|
GlslDepthTextureData{ast::TextureDimension::k2dArray,
|
||||||
"Texture2DArray tex : register(t1, space2);"},
|
"Texture2DArray tex;"},
|
||||||
GlslDepthTextureData{ast::TextureDimension::kCube,
|
GlslDepthTextureData{ast::TextureDimension::kCube, "TextureCube tex;"},
|
||||||
"TextureCube tex : register(t1, space2);"},
|
|
||||||
GlslDepthTextureData{ast::TextureDimension::kCubeArray,
|
GlslDepthTextureData{ast::TextureDimension::kCubeArray,
|
||||||
"TextureCubeArray tex : register(t1, space2);"}));
|
"TextureCubeArray tex;"}));
|
||||||
|
|
||||||
using GlslDepthMultisampledTexturesTest = TestHelper;
|
using GlslDepthMultisampledTexturesTest = TestHelper;
|
||||||
TEST_F(GlslDepthMultisampledTexturesTest, Emit) {
|
TEST_F(GlslDepthMultisampledTexturesTest, Emit) {
|
||||||
|
@ -377,8 +375,7 @@ TEST_F(GlslDepthMultisampledTexturesTest, Emit) {
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_THAT(gen.result(),
|
EXPECT_THAT(gen.result(), HasSubstr("Texture2DMS<float4> tex;"));
|
||||||
HasSubstr("Texture2DMS<float4> tex : register(t1, space2);"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class TextureDataType { F32, U32, I32 };
|
enum class TextureDataType { F32, U32, I32 };
|
||||||
|
@ -424,100 +421,99 @@ TEST_P(GlslSampledTexturesTest, Emit) {
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_THAT(gen.result(), HasSubstr(params.result));
|
EXPECT_THAT(gen.result(), HasSubstr(params.result));
|
||||||
}
|
}
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(GlslGeneratorImplTest_Type,
|
||||||
GlslGeneratorImplTest_Type,
|
GlslSampledTexturesTest,
|
||||||
GlslSampledTexturesTest,
|
testing::Values(
|
||||||
testing::Values(
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k1d,
|
||||||
ast::TextureDimension::k1d,
|
TextureDataType::F32,
|
||||||
TextureDataType::F32,
|
"Texture1D<float4> tex;",
|
||||||
"Texture1D<float4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k2d,
|
||||||
ast::TextureDimension::k2d,
|
TextureDataType::F32,
|
||||||
TextureDataType::F32,
|
"Texture2D<float4> tex;",
|
||||||
"Texture2D<float4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k2dArray,
|
||||||
ast::TextureDimension::k2dArray,
|
TextureDataType::F32,
|
||||||
TextureDataType::F32,
|
"Texture2DArray<float4> tex;",
|
||||||
"Texture2DArray<float4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k3d,
|
||||||
ast::TextureDimension::k3d,
|
TextureDataType::F32,
|
||||||
TextureDataType::F32,
|
"Texture3D<float4> tex;",
|
||||||
"Texture3D<float4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::kCube,
|
||||||
ast::TextureDimension::kCube,
|
TextureDataType::F32,
|
||||||
TextureDataType::F32,
|
"TextureCube<float4> tex;",
|
||||||
"TextureCube<float4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::kCubeArray,
|
||||||
ast::TextureDimension::kCubeArray,
|
TextureDataType::F32,
|
||||||
TextureDataType::F32,
|
"TextureCubeArray<float4> tex;",
|
||||||
"TextureCubeArray<float4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k1d,
|
||||||
ast::TextureDimension::k1d,
|
TextureDataType::U32,
|
||||||
TextureDataType::U32,
|
"Texture1D<uint4> tex;",
|
||||||
"Texture1D<uint4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k2d,
|
||||||
ast::TextureDimension::k2d,
|
TextureDataType::U32,
|
||||||
TextureDataType::U32,
|
"Texture2D<uint4> tex;",
|
||||||
"Texture2D<uint4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k2dArray,
|
||||||
ast::TextureDimension::k2dArray,
|
TextureDataType::U32,
|
||||||
TextureDataType::U32,
|
"Texture2DArray<uint4> tex;",
|
||||||
"Texture2DArray<uint4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k3d,
|
||||||
ast::TextureDimension::k3d,
|
TextureDataType::U32,
|
||||||
TextureDataType::U32,
|
"Texture3D<uint4> tex;",
|
||||||
"Texture3D<uint4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::kCube,
|
||||||
ast::TextureDimension::kCube,
|
TextureDataType::U32,
|
||||||
TextureDataType::U32,
|
"TextureCube<uint4> tex;",
|
||||||
"TextureCube<uint4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::kCubeArray,
|
||||||
ast::TextureDimension::kCubeArray,
|
TextureDataType::U32,
|
||||||
TextureDataType::U32,
|
"TextureCubeArray<uint4> tex;",
|
||||||
"TextureCubeArray<uint4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k1d,
|
||||||
ast::TextureDimension::k1d,
|
TextureDataType::I32,
|
||||||
TextureDataType::I32,
|
"Texture1D<int4> tex;",
|
||||||
"Texture1D<int4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k2d,
|
||||||
ast::TextureDimension::k2d,
|
TextureDataType::I32,
|
||||||
TextureDataType::I32,
|
"Texture2D<int4> tex;",
|
||||||
"Texture2D<int4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k2dArray,
|
||||||
ast::TextureDimension::k2dArray,
|
TextureDataType::I32,
|
||||||
TextureDataType::I32,
|
"Texture2DArray<int4> tex;",
|
||||||
"Texture2DArray<int4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::k3d,
|
||||||
ast::TextureDimension::k3d,
|
TextureDataType::I32,
|
||||||
TextureDataType::I32,
|
"Texture3D<int4> tex;",
|
||||||
"Texture3D<int4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::kCube,
|
||||||
ast::TextureDimension::kCube,
|
TextureDataType::I32,
|
||||||
TextureDataType::I32,
|
"TextureCube<int4> tex;",
|
||||||
"TextureCube<int4> tex : register(t1, space2);",
|
},
|
||||||
},
|
GlslSampledTextureData{
|
||||||
GlslSampledTextureData{
|
ast::TextureDimension::kCubeArray,
|
||||||
ast::TextureDimension::kCubeArray,
|
TextureDataType::I32,
|
||||||
TextureDataType::I32,
|
"TextureCubeArray<int4> tex;",
|
||||||
"TextureCubeArray<int4> tex : register(t1, space2);",
|
}));
|
||||||
}));
|
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Type, EmitMultisampledTexture) {
|
TEST_F(GlslGeneratorImplTest_Type, EmitMultisampledTexture) {
|
||||||
auto* f32 = create<sem::F32>();
|
auto* f32 = create<sem::F32>();
|
||||||
|
@ -564,46 +560,45 @@ TEST_P(GlslStorageTexturesTest, Emit) {
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
GlslGeneratorImplTest_Type,
|
GlslGeneratorImplTest_Type,
|
||||||
GlslStorageTexturesTest,
|
GlslStorageTexturesTest,
|
||||||
testing::Values(
|
testing::Values(GlslStorageTextureData{ast::TextureDimension::k1d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRgba8Unorm,
|
||||||
ast::TextureDimension::k1d, ast::ImageFormat::kRgba8Unorm,
|
"RWTexture1D<float4> tex;"},
|
||||||
"RWTexture1D<float4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k2d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRgba16Float,
|
||||||
ast::TextureDimension::k2d, ast::ImageFormat::kRgba16Float,
|
"RWTexture2D<float4> tex;"},
|
||||||
"RWTexture2D<float4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k2dArray,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kR32Float,
|
||||||
ast::TextureDimension::k2dArray, ast::ImageFormat::kR32Float,
|
"RWTexture2DArray<float4> tex;"},
|
||||||
"RWTexture2DArray<float4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k3d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRg32Float,
|
||||||
ast::TextureDimension::k3d, ast::ImageFormat::kRg32Float,
|
"RWTexture3D<float4> tex;"},
|
||||||
"RWTexture3D<float4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k1d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRgba32Float,
|
||||||
ast::TextureDimension::k1d, ast::ImageFormat::kRgba32Float,
|
"RWTexture1D<float4> tex;"},
|
||||||
"RWTexture1D<float4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k2d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRgba16Uint,
|
||||||
ast::TextureDimension::k2d, ast::ImageFormat::kRgba16Uint,
|
"RWTexture2D<uint4> tex;"},
|
||||||
"RWTexture2D<uint4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k2dArray,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kR32Uint,
|
||||||
ast::TextureDimension::k2dArray, ast::ImageFormat::kR32Uint,
|
"RWTexture2DArray<uint4> tex;"},
|
||||||
"RWTexture2DArray<uint4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k3d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRg32Uint,
|
||||||
ast::TextureDimension::k3d, ast::ImageFormat::kRg32Uint,
|
"RWTexture3D<uint4> tex;"},
|
||||||
"RWTexture3D<uint4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k1d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRgba32Uint,
|
||||||
ast::TextureDimension::k1d, ast::ImageFormat::kRgba32Uint,
|
"RWTexture1D<uint4> tex;"},
|
||||||
"RWTexture1D<uint4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k2d,
|
||||||
GlslStorageTextureData{ast::TextureDimension::k2d,
|
ast::ImageFormat::kRgba16Sint,
|
||||||
ast::ImageFormat::kRgba16Sint,
|
"RWTexture2D<int4> tex;"},
|
||||||
"RWTexture2D<int4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k2dArray,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kR32Sint,
|
||||||
ast::TextureDimension::k2dArray, ast::ImageFormat::kR32Sint,
|
"RWTexture2DArray<int4> tex;"},
|
||||||
"RWTexture2DArray<int4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k3d,
|
||||||
GlslStorageTextureData{ast::TextureDimension::k3d,
|
ast::ImageFormat::kRg32Sint,
|
||||||
ast::ImageFormat::kRg32Sint,
|
"RWTexture3D<int4> tex;"},
|
||||||
"RWTexture3D<int4> tex : register(u1, space2);"},
|
GlslStorageTextureData{ast::TextureDimension::k1d,
|
||||||
GlslStorageTextureData{
|
ast::ImageFormat::kRgba32Sint,
|
||||||
ast::TextureDimension::k1d, ast::ImageFormat::kRgba32Sint,
|
"RWTexture1D<int4> tex;"}));
|
||||||
"RWTexture1D<int4> tex : register(u1, space2);"}));
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace glsl
|
} // namespace glsl
|
||||||
|
|
|
@ -76,7 +76,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) {
|
||||||
gen.increment_indent();
|
gen.increment_indent();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_THAT(gen.result(), HasSubstr(" static float a = 0.0f;\n"));
|
EXPECT_THAT(gen.result(), HasSubstr(" float a = 0.0f;\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_VariableDecl,
|
TEST_F(GlslGeneratorImplTest_VariableDecl,
|
||||||
|
|
Loading…
Reference in New Issue