forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate CBuffer size to max of 65536 bytes (microsoft#3507)
- Loading branch information
Showing
10 changed files
with
92 additions
and
0 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
14 changes: 14 additions & 0 deletions
14
tools/clang/test/HLSLFileCheck/hlsl/objects/CbufferLegacy/cbufferSize1.hlsl
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,14 @@ | ||
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s | ||
|
||
// CHECK: error: CBuffer size is 65552 bytes, exceeding maximum of 65536 bytes. | ||
|
||
cbuffer Foo1 : register(b5) | ||
{ | ||
float4 g1 : packoffset(c4096); | ||
float4 g2 : packoffset(c0); | ||
} | ||
|
||
float4 main() : SV_TARGET | ||
{ | ||
return g2+g1; | ||
} |
13 changes: 13 additions & 0 deletions
13
tools/clang/test/HLSLFileCheck/hlsl/objects/CbufferLegacy/cbufferSize2.hlsl
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,13 @@ | ||
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s | ||
|
||
// CHECK: call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %{{.*}}, i32 4095) | ||
|
||
cbuffer Foo1 : register(b5) | ||
{ | ||
float arr[4096]; | ||
} | ||
|
||
float4 main() : SV_TARGET | ||
{ | ||
return arr[4095]; | ||
} |
13 changes: 13 additions & 0 deletions
13
tools/clang/test/HLSLFileCheck/hlsl/objects/CbufferLegacy/cbufferSize3.hlsl
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,13 @@ | ||
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s | ||
|
||
// CHECK: error: CBuffer size is 65540 bytes, exceeding maximum of 65536 bytes. | ||
|
||
cbuffer Foo1 : register(b5) | ||
{ | ||
float arr[4097]; | ||
} | ||
|
||
float4 main() : SV_TARGET | ||
{ | ||
return arr[4096]; | ||
} |
14 changes: 14 additions & 0 deletions
14
tools/clang/test/HLSLFileCheck/hlsl/objects/CbufferLegacy/cbufferSize4.hlsl
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,14 @@ | ||
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s | ||
|
||
// CHECK: call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %{{.*}}, i32 4095) | ||
|
||
cbuffer Foo1 : register(b5) | ||
{ | ||
float arr[4096]; | ||
float3 after_array; | ||
} | ||
|
||
float4 main() : SV_TARGET | ||
{ | ||
return float4(arr[4095], after_array); | ||
} |
15 changes: 15 additions & 0 deletions
15
tools/clang/test/HLSLFileCheck/hlsl/objects/CbufferLegacy/cbufferSize5.hlsl
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,15 @@ | ||
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s | ||
|
||
// CHECK: error: CBuffer size is 65540 bytes, exceeding maximum of 65536 bytes. | ||
|
||
cbuffer Foo1 : register(b5) | ||
{ | ||
float arr[4096]; | ||
float3 after_array; | ||
float overflow; | ||
} | ||
|
||
float4 main() : SV_TARGET | ||
{ | ||
return float4(arr[4095] + overflow, after_array); | ||
} |
13 changes: 13 additions & 0 deletions
13
tools/clang/test/HLSLFileCheck/hlsl/objects/CbufferLegacy/cbufferSize6.hlsl
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,13 @@ | ||
// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s | ||
|
||
// CHECK: error: CBuffer size is 65540 bytes, exceeding maximum of 65536 bytes. | ||
|
||
cbuffer Foo1 : register(b5) | ||
{ | ||
float arr[4096] : packoffset(c1); | ||
} | ||
|
||
float4 main() : SV_TARGET | ||
{ | ||
return arr[4095]; | ||
} |
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