summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2019-02-05 16:47:37 -0800
committerGitHub <noreply@github.com>2019-02-05 16:47:37 -0800
commit13d7e34d8be4316c59bd3d00a1e5526215db6fa4 (patch)
tree1a774f323300e72ca2ae66db2d883491f0790d39 /tests
parent43950e2b2f2b1109fe25e67fc678272af6dfb7ef (diff)
parent60cc9f24c4bec54561bea873ee943aa3d0973dc2 (diff)
Merge branch 'master' into fix-nested-type-conformances
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-357.slang6
-rw-r--r--tests/compute/assoctype-generic-arg.slang6
-rw-r--r--tests/compute/global-type-param-array.slang9
-rw-r--r--tests/compute/global-type-param-in-entrypoint.slang2
-rw-r--r--tests/compute/global-type-param.slang4
-rw-r--r--tests/compute/global-type-param1.slang9
-rw-r--r--tests/compute/global-type-param2.slang9
-rw-r--r--tests/compute/int-generic.slang10
-rw-r--r--tests/compute/tagged-union.slang24
-rw-r--r--tests/reflection/global-type-params.slang4
10 files changed, 36 insertions, 47 deletions
diff --git a/tests/bugs/gh-357.slang b/tests/bugs/gh-357.slang
index be2ba95ed..043eebf17 100644
--- a/tests/bugs/gh-357.slang
+++ b/tests/bugs/gh-357.slang
@@ -25,11 +25,9 @@ struct AssocImpl : IAssoc
typedef BaseImpl TBase;
};
-__generic_param T : IAssoc;
-
-
[numthreads(4, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+void computeMain<T:IAssoc>(
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
T.TBase base;
diff --git a/tests/compute/assoctype-generic-arg.slang b/tests/compute/assoctype-generic-arg.slang
index 4bc77c925..dd183ea5d 100644
--- a/tests/compute/assoctype-generic-arg.slang
+++ b/tests/compute/assoctype-generic-arg.slang
@@ -25,11 +25,9 @@ struct AssocImpl : IAssoc
typedef BaseImpl TBase;
};
-__generic_param T : IAssoc;
-
-
[numthreads(4, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+void computeMain<T : IAssoc>(
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
T.TBase base;
diff --git a/tests/compute/global-type-param-array.slang b/tests/compute/global-type-param-array.slang
index 87236d8f6..d801efe2c 100644
--- a/tests/compute/global-type-param-array.slang
+++ b/tests/compute/global-type-param-array.slang
@@ -6,17 +6,16 @@
RWStructuredBuffer<float> outputBuffer;
import globalTypeParamArrayShared;
-__generic_param TImpl : IBase;
-
-ParameterBlock<TImpl> impl;
-
float doCompute<T:IBase>(T t)
{
return t.compute(1.0);
}
[numthreads(1, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+void computeMain<
+ TImpl : IBase>(
+ uniform ParameterBlock<TImpl> impl,
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
float outVal = doCompute<TImpl>(impl);
diff --git a/tests/compute/global-type-param-in-entrypoint.slang b/tests/compute/global-type-param-in-entrypoint.slang
index 4bcf4cbca..9a1e9b054 100644
--- a/tests/compute/global-type-param-in-entrypoint.slang
+++ b/tests/compute/global-type-param-in-entrypoint.slang
@@ -8,7 +8,7 @@ interface IVertInterpolant
float4 getColor();
}
-__generic_param TVertInterpolant : IVertInterpolant;
+type_param TVertInterpolant : IVertInterpolant;
struct VertImpl : IVertInterpolant
{
diff --git a/tests/compute/global-type-param.slang b/tests/compute/global-type-param.slang
index f177dcb1d..7621f8961 100644
--- a/tests/compute/global-type-param.slang
+++ b/tests/compute/global-type-param.slang
@@ -26,10 +26,8 @@ struct Impl : IBase
}
};
-__generic_param TImpl : IBase;
-
[numthreads(1, 1, 1)]
-void computeMain(
+void computeMain<TImpl:IBase>(
uniform TImpl impl,
uint3 dispatchThreadID : SV_DispatchThreadID)
{
diff --git a/tests/compute/global-type-param1.slang b/tests/compute/global-type-param1.slang
index e16ffa9da..f33be8ec7 100644
--- a/tests/compute/global-type-param1.slang
+++ b/tests/compute/global-type-param1.slang
@@ -26,10 +26,6 @@ struct Impl : IBase
}
};
-__generic_param TImpl : IBase;
-
-ParameterBlock<TImpl> impl;
-
cbuffer C
{
float base0; // = 0.5
@@ -39,7 +35,10 @@ Texture2D tex1; // = 0.0
SamplerState sampler;
[numthreads(1, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+void computeMain<
+ TImpl : IBase>(
+ uniform ParameterBlock<TImpl> impl,
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
float b0 = tex1.SampleLevel(sampler, float2(0.0), 0.0).x + base0; // = 0.5
diff --git a/tests/compute/global-type-param2.slang b/tests/compute/global-type-param2.slang
index f29d01407..976a31df8 100644
--- a/tests/compute/global-type-param2.slang
+++ b/tests/compute/global-type-param2.slang
@@ -38,10 +38,6 @@ struct Impl : IBase
}
};
-__generic_param TImpl : IBase;
-
-ParameterBlock<TImpl> impl;
-
// at binding c0:
cbuffer existingBuffer
{
@@ -51,7 +47,10 @@ Texture2D tex1; // = 0.0
SamplerState sampler;
[numthreads(1, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+void computeMain<
+ TImpl : IBase>(
+ uniform ParameterBlock<TImpl> impl,
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
float b0 = tex1.SampleLevel(sampler, float2(0.0), 0.0).x + base0; // = 0.5
diff --git a/tests/compute/int-generic.slang b/tests/compute/int-generic.slang
index 6bb63df8c..d9eb85f82 100644
--- a/tests/compute/int-generic.slang
+++ b/tests/compute/int-generic.slang
@@ -29,14 +29,12 @@ struct Material<let A:int, let B: int> : IMaterial
TBRDF getBRDF() { TBRDF a; a.c = 0; return a; }
};
-type_param TMaterial : IMaterial;
-
-TMaterial material;
-
[numthreads(1, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+void computeMain<M : IMaterial>(
+ uniform M material,
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
- TMaterial.TBRDF brdf = material.getBRDF();
+ M.TBRDF brdf = material.getBRDF();
int outVal = brdf.compute();
outputBuffer[dispatchThreadID.x] = outVal;
} \ No newline at end of file
diff --git a/tests/compute/tagged-union.slang b/tests/compute/tagged-union.slang
index 5089ec5a7..de69232f9 100644
--- a/tests/compute/tagged-union.slang
+++ b/tests/compute/tagged-union.slang
@@ -44,11 +44,13 @@ struct B : IFrobnicator
}
}
+[numthreads(4, 1, 1)]
+void computeMain
// Now we will define the generic type parameter for our shader,
// which will be constraints to be a type that implements our
// `IFrobnicator` interface.
//
-type_param T : IFrobnicator;
+ <T : IFrobnicator>
//
// For the actual test runner, we will instruct it to plug in
// a tagged-union type over the two concrete implemetnations.
@@ -57,7 +59,7 @@ type_param T : IFrobnicator;
// our intention when it is informed via the API.
//
//TEST_INPUT: type __TaggedUnion(A,B)
-
+ (
// Next we need to pass in the actual parameter data for our
// chosen `IFrobnicator` implementation. The decalration of
// the constant buffer follows the conventional approach for
@@ -68,7 +70,7 @@ type_param T : IFrobnicator;
// the `render-test` tool doesn't yet support code that
// uses multiple descriptor tables/sets.
//
-ConstantBuffer<T> gFrobnicator;
+ uniform ConstantBuffer<T> gFrobnicator,
// Where things get interesting is when we go to provide the
// data that will be used by the parameter block.
@@ -92,17 +94,15 @@ ConstantBuffer<T> gFrobnicator;
//
//TEST_INPUT: cbuffer(data=[16 9 1 0 0], stride=4):dxbinding(0),glbinding(0)
-int test(int val)
-{
- return gFrobnicator.frobnicate(val);
-}
//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(1),out
-RWStructuredBuffer<int> gOutputBuffer;
-
-[numthreads(4, 1, 1)]
-void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+ uniform RWStructuredBuffer<int> gOutputBuffer,
+ uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
- gOutputBuffer[tid] = test(tid);
+
+ int val = tid;
+ val = gFrobnicator.frobnicate(val);
+
+ gOutputBuffer[tid] = val;
}
diff --git a/tests/reflection/global-type-params.slang b/tests/reflection/global-type-params.slang
index 74961b7cc..290e6353a 100644
--- a/tests/reflection/global-type-params.slang
+++ b/tests/reflection/global-type-params.slang
@@ -7,8 +7,8 @@
interface IBase
{};
-__generic_param TParam : IBase;
-__generic_param TParam2 : IBase;
+type_param TParam : IBase;
+type_param TParam2 : IBase;
struct S
{