From 563fc0cb8268a3e028f32b93ca94ff1c27cd1a10 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 19 Dec 2017 15:17:23 -0800 Subject: Fix up parameter block emit for mixed rewriter+IR (#316) * Fix up parameter block emit for mixed rewriter+IR The basic problem here arose when a parameter block was declared in code that will be lowered via IR, but is referenced from user code that will use the AST-based lowering pass. The type legalization would split up the parameter block, and the AST would refer to the new variables, but it would fail to recognize when those variables represent constant buffers, and thus should get implicit-dereference behavior. The fix here was just to propagate type information through when creating new AST (pseudo-)expressions to represent IR declarations that were split. A more complete fix down the road should try to make sure that both the expression emit logic and the declaration-emit logic agree on whether a particular declaration of a parameter block or constant buffer needs to support the "implicit dereference" case or not. I'm leaving that to future work. With this change, two test cases that had been disabled now pass. * Fixup: don't do implicit deref for `ParameterBlock` values Right now the rules for `ParameterBlock` and all other uniform praameter groups needs to be different, but the `isImplicitBaseExpr` logic wasn't taking that into account. --- tests/compute/rewriter-parameter-block-complex.hlsl | 2 +- tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt | 4 ++++ tests/compute/rewriter-parameter-block.hlsl | 2 +- tests/compute/rewriter-parameter-block.hlsl.2.expected.txt | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt create mode 100644 tests/compute/rewriter-parameter-block.hlsl.2.expected.txt (limited to 'tests') diff --git a/tests/compute/rewriter-parameter-block-complex.hlsl b/tests/compute/rewriter-parameter-block-complex.hlsl index fe7aae4a6..18a37a6ef 100644 --- a/tests/compute/rewriter-parameter-block-complex.hlsl +++ b/tests/compute/rewriter-parameter-block-complex.hlsl @@ -1,6 +1,6 @@ //TEST(compute):HLSL_COMPUTE:-xslang -no-checking //TEST(compute):COMPARE_COMPUTE:-xslang -use-ir -//DISABLED_TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir +//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out diff --git a/tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt b/tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt new file mode 100644 index 000000000..883f72716 --- /dev/null +++ b/tests/compute/rewriter-parameter-block-complex.hlsl.2.expected.txt @@ -0,0 +1,4 @@ +1110 +1121 +1132 +1143 diff --git a/tests/compute/rewriter-parameter-block.hlsl b/tests/compute/rewriter-parameter-block.hlsl index 9d3140475..0a6f5d52e 100644 --- a/tests/compute/rewriter-parameter-block.hlsl +++ b/tests/compute/rewriter-parameter-block.hlsl @@ -1,6 +1,6 @@ //TEST(compute):HLSL_COMPUTE:-xslang -no-checking //TEST(compute):COMPARE_COMPUTE:-xslang -use-ir -//DISABLED_TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir +//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir //TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out diff --git a/tests/compute/rewriter-parameter-block.hlsl.2.expected.txt b/tests/compute/rewriter-parameter-block.hlsl.2.expected.txt new file mode 100644 index 000000000..479b9e0da --- /dev/null +++ b/tests/compute/rewriter-parameter-block.hlsl.2.expected.txt @@ -0,0 +1,4 @@ +11110 +11121 +11132 +11143 -- cgit v1.2.3