-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix spirv emit that leads to pathological downstream time. (#3546)
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry computeMain -stage compute -emit-spirv-directly | ||
|
||
// Check that we are not generating spirv that loads a global resource array into a SSA register, | ||
// instead, these arrays should always be accessed via direct OpAccessChain operations to avoid | ||
// creating a lot of local load/stores in the driver compiler. | ||
|
||
struct Scene | ||
{ | ||
SamplerState samplers[256]; | ||
Texture2D textures[100]; | ||
} | ||
|
||
ParameterBlock<Scene> scene; | ||
struct Material | ||
{ | ||
int sampler; | ||
int texture; | ||
} | ||
|
||
RWStructuredBuffer<float4> result; | ||
|
||
float4 shade(Scene scene, Material mat) | ||
{ | ||
return scene.textures[mat.texture].SampleLevel(scene.samplers[mat.sampler], float2(0,0), 0); | ||
} | ||
|
||
[numthreads(1,1,1)] | ||
void computeMain(uniform Material mat) | ||
{ | ||
// CHECK: OpEntryPoint | ||
// CHECK-NOT: OpLoad {{.*}} %scene{{.*}}samplers | ||
// CHECK-NOT: OpLoad {{.*}} %scene{{.*}}textures | ||
result[0] = shade(scene, mat); | ||
} |