summaryrefslogtreecommitdiffstats
path: root/tests/reflection
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-12-06 12:05:07 -0800
committerGitHub <noreply@github.com>2023-12-06 12:05:07 -0800
commit11111e5733b189127dc2c4934d67693b9bc6e764 (patch)
tree0ba84df3e856eb104abec2ecac47242bc70a7b7d /tests/reflection
parentfa6d8717d02912697c09f2d7de802723ac6d6e47 (diff)
Support visibility control and default to `internal`. (#3380)
* Support visibility control and default to `internal`. * Fix wip. * Fixes. * Fix. * Fix test. * Add legacy language detection and compatibility for existing code. * Add doc. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/reflection')
-rw-r--r--tests/reflection/multi-file-defines.h3
-rw-r--r--tests/reflection/multi-file-shared.slang28
-rw-r--r--tests/reflection/reflect-imported-code.slang12
3 files changed, 22 insertions, 21 deletions
diff --git a/tests/reflection/multi-file-defines.h b/tests/reflection/multi-file-defines.h
index aed4c510a..0948df378 100644
--- a/tests/reflection/multi-file-defines.h
+++ b/tests/reflection/multi-file-defines.h
@@ -5,12 +5,13 @@
#define BEGIN_CBUFFER(NAME) cbuffer NAME
#define END_CBUFFER(NAME, REG) /**/
#define CBUFFER_REF(NAME, FIELD) FIELD
+#define PUBLIC public
#else
#define R(X) /*X*/
#define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME
#define END_CBUFFER(NAME, REG) ; cbuffer NAME /*REG*/ { SLANG_ParameterGroup_##NAME NAME; }
#define CBUFFER_REF(NAME, FIELD) NAME.FIELD
-
+#define PUBLIC
#define sharedC sharedC_0
#define sharedCA sharedCA_0
#define sharedCB sharedCB_0
diff --git a/tests/reflection/multi-file-shared.slang b/tests/reflection/multi-file-shared.slang
index af91d5251..91a74cd35 100644
--- a/tests/reflection/multi-file-shared.slang
+++ b/tests/reflection/multi-file-shared.slang
@@ -3,23 +3,23 @@
#include "multi-file-defines.h"
-float4 use(float val) { return val; };
-float4 use(float2 val) { return float4(val,0.0,0.0); };
-float4 use(float3 val) { return float4(val,0.0); };
-float4 use(float4 val) { return val; };
-float4 use(Texture2D t, SamplerState s) { return t.SampleLevel(s, 0.0, 0.0); }
+PUBLIC float4 use(float val) { return val; };
+PUBLIC float4 use(float2 val) { return float4(val,0.0,0.0); };
+PUBLIC float4 use(float3 val) { return float4(val,0.0); };
+PUBLIC float4 use(float4 val) { return val; };
+PUBLIC float4 use(Texture2D t, SamplerState s) { return t.SampleLevel(s, 0.0, 0.0); }
-Texture2D sharedT R(: register(t2));
-SamplerState sharedS R(: register(s2));
+PUBLIC Texture2D sharedT R(: register(t2));
+PUBLIC SamplerState sharedS R(: register(s2));
-BEGIN_CBUFFER(sharedC)
+PUBLIC BEGIN_CBUFFER(sharedC)
{
- float3 sharedCA;
- float sharedCB;
- float3 sharedCC;
- float2 sharedCD;
+ PUBLIC float3 sharedCA;
+ PUBLIC float sharedCB;
+ PUBLIC float3 sharedCC;
+ PUBLIC float2 sharedCD;
}
END_CBUFFER(sharedC, register(b2))
-Texture2D sharedTV R(: register(t3));
-Texture2D sharedTF R(: register(t4));
+PUBLIC Texture2D sharedTV R(: register(t3));
+PUBLIC Texture2D sharedTF R(: register(t4));
diff --git a/tests/reflection/reflect-imported-code.slang b/tests/reflection/reflect-imported-code.slang
index 20beb94b8..4600a371c 100644
--- a/tests/reflection/reflect-imported-code.slang
+++ b/tests/reflection/reflect-imported-code.slang
@@ -2,13 +2,13 @@
// Imported code used by `reflect-imported-code.hlsl`
-float4 use(float4 val) { return val; };
-float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }
+public float4 use(float4 val) { return val; };
+public float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }
-Texture2D t_i;
-SamplerState s_i;
+public Texture2D t_i;
+public SamplerState s_i;
-cbuffer C_i
+public cbuffer C_i
{
- float c_i;
+ public float c_i;
}