mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-06 06:33:30 +00:00
writer/hlsl: Emit static
for private global variables
Fixed: tint:812 Change-Id: I822eb6b13f07a74eb47c4c8e18d1f75dcc4818bf Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51366 Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: James Price <jrprice@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
ee449e2625
commit
09d53d5ed1
@ -1893,9 +1893,11 @@ bool GeneratorImpl::EmitEntryPointData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (var->StorageClass()) {
|
switch (var->StorageClass()) {
|
||||||
case ast::StorageClass::kPrivate:
|
|
||||||
case ast::StorageClass::kUniformConstant:
|
case ast::StorageClass::kUniformConstant:
|
||||||
break;
|
break;
|
||||||
|
case ast::StorageClass::kPrivate:
|
||||||
|
out << "static ";
|
||||||
|
break;
|
||||||
case ast::StorageClass::kWorkgroup:
|
case ast::StorageClass::kWorkgroup:
|
||||||
out << "groupshared ";
|
out << "groupshared ";
|
||||||
break;
|
break;
|
||||||
|
@ -137,7 +137,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) {
|
|||||||
float mem;
|
float mem;
|
||||||
};
|
};
|
||||||
|
|
||||||
Data str;
|
static Data str;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void test_function() {
|
void test_function() {
|
||||||
|
@ -75,7 +75,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Private) {
|
|||||||
gen.increment_indent();
|
gen.increment_indent();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate(out)) << gen.error();
|
ASSERT_TRUE(gen.Generate(out)) << gen.error();
|
||||||
EXPECT_THAT(result(), HasSubstr(" float a;\n"));
|
EXPECT_THAT(result(), HasSubstr(" static float a;\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_VariableDecl,
|
TEST_F(HlslGeneratorImplTest_VariableDecl,
|
||||||
|
@ -1 +1 @@
|
|||||||
SKIP: TINT_UNIMPLEMENTED crbug.com/tint/726: module-scope private and workgroup variables not yet implemented
|
SKIP: crbug.com/tint/818: [HLSL] Loop emission broken for `let` function declarations
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
int I = 0;
|
static int I = 0;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
int I;
|
static int I;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -1 +1,14 @@
|
|||||||
SKIP: error: pointers not supported in HLSL
|
struct S {
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
|
||||||
|
static S V;
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main() {
|
||||||
|
int i = 0;
|
||||||
|
const int x_15 = V.i;
|
||||||
|
i = x_15;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ struct S {
|
|||||||
int i;
|
int i;
|
||||||
};
|
};
|
||||||
|
|
||||||
S V;
|
static S V;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
int I = 0;
|
static int I = 0;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
int I;
|
static int I;
|
||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -1 +1,12 @@
|
|||||||
SKIP: error: pointers not supported in HLSL
|
struct S {
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
|
||||||
|
static S V;
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main() {
|
||||||
|
V.i = 5;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
SKIP: error: pointers not supported in HLSL
|
SKIP: Failed to generate: error: pointers not supported in HLSL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user