-
Notifications
You must be signed in to change notification settings - Fork 848
[SPIR-V][vk::SampledTexture] #11. Support vk::SampledTexture1D and vk::SampledTexture1DArray type.
#8212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[SPIR-V][vk::SampledTexture] #11. Support vk::SampledTexture1D and vk::SampledTexture1DArray type.
#8212
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ccb25ca
Implement vk::SampledTexture2DArray
luciechoi 8846cd8
SampledTexture1D, SampledTexture1DArray
luciechoi 0c2fe8d
Address comments and add tests
luciechoi 27e3e73
update string matching
luciechoi b8ebfeb
Fix starts_with
luciechoi a228113
address comments
luciechoi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
38 changes: 38 additions & 0 deletions
38
...s/clang/test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.access.hlsl
This file contains hidden or 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,38 @@ | ||
| // RUN: %dxc -T ps_6_7 -E main -fcgl %s -spirv | FileCheck %s | ||
| // RUN: not %dxc -T ps_6_7 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR | ||
|
|
||
| // CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown | ||
| // CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image | ||
|
|
||
| vk::SampledTexture1D<float4> tex1d; | ||
|
|
||
| struct S { int a; }; | ||
|
|
||
| void main() { | ||
| // CHECK: OpStore %pos1 %uint_1 | ||
| uint pos1 = 1; | ||
|
|
||
| // CHECK: [[pos1:%[a-zA-Z0-9_]+]] = OpLoad %uint %pos1 | ||
| // CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d | ||
| // CHECK: [[tex_image:%[a-zA-Z0-9_]+]] = OpImage %type_1d_image [[tex1_load]] | ||
| // CHECK: [[fetch_result:%[a-zA-Z0-9_]+]] = OpImageFetch %v4float [[tex_image]] [[pos1]] Lod %uint_0 | ||
| // CHECK: OpStore %a1 [[fetch_result]] | ||
| float4 a1 = tex1d[pos1]; | ||
Keenuts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #ifdef ERROR | ||
| S s = { 1 }; | ||
| // CHECK-ERROR: error: no viable overloaded operator[] | ||
| // CHECK-ERROR: note: candidate function {{.*}} no known conversion from 'S' to 'unsigned int' for 1st argument | ||
| float4 val2 = tex1d[s]; | ||
|
|
||
| int2 i2 = int2(1, 2); | ||
| // CHECK-ERROR: error: no viable overloaded operator[] | ||
| // CHECK-ERROR: note: candidate function {{.*}} no known conversion from '{{int2|vector<int, 2>}}' to 'unsigned int' for 1st argument | ||
| float4 val3 = tex1d[i2]; | ||
|
|
||
| int3 i3 = int3(1, 2, 3); | ||
| // CHECK-ERROR: error: no viable overloaded operator[] | ||
| // CHECK-ERROR: note: candidate function {{.*}} no known conversion from '{{int3|vector<int, 3>}}' to 'unsigned int' for 1st argument | ||
| float4 val4 = tex1d[i3]; | ||
| #endif | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
...GenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod-unclamped.hlsl
This file contains hidden or 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,19 @@ | ||
| // RUN: %dxc -T ps_6_8 -E main -fcgl %s -spirv | FileCheck %s | ||
|
|
||
| // CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown | ||
| // CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image | ||
|
|
||
| vk::SampledTexture1D<float4> tex1d; | ||
|
|
||
| void main() { | ||
| // CHECK: OpStore %x %float_0_5 | ||
| float x = 0.5; | ||
|
|
||
| // CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d | ||
| // CHECK: [[x:%[a-zA-Z0-9_]+]] = OpLoad %float %x | ||
| // CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[x]] | ||
| // CHECK: [[unclamped_lod:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[lod_query]] 1 | ||
| // CHECK: OpStore %lod1 [[unclamped_lod]] | ||
| float lod1 = tex1d.CalculateLevelOfDetailUnclamped(x); | ||
|
|
||
| } |
19 changes: 19 additions & 0 deletions
19
.../test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.calculate-lod.hlsl
This file contains hidden or 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,19 @@ | ||
| // RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s | ||
|
|
||
| // CHECK: %type_1d_image = OpTypeImage %float 1D 0 0 0 1 Unknown | ||
| // CHECK: %type_sampled_image = OpTypeSampledImage %type_1d_image | ||
|
|
||
| vk::SampledTexture1D<float4> tex1d; | ||
|
|
||
| void main() { | ||
| // CHECK: OpStore %x %float_0_5 | ||
| float x = 0.5; | ||
|
|
||
| // CHECK: [[tex1_load:%[a-zA-Z0-9_]+]] = OpLoad %type_sampled_image %tex1d | ||
| // CHECK: [[x:%[a-zA-Z0-9_]+]] = OpLoad %float %x | ||
| // CHECK: [[lod_query:%[a-zA-Z0-9_]+]] = OpImageQueryLod %v2float [[tex1_load]] [[x]] | ||
| // CHECK: [[lod:%[a-zA-Z0-9_]+]] = OpCompositeExtract %float [[lod_query]] 0 | ||
| // CHECK: OpStore %lod [[lod]] | ||
| float lod = tex1d.CalculateLevelOfDetail(x); | ||
|
|
||
| } |
75 changes: 75 additions & 0 deletions
75
...test/CodeGenSPIRV/SampledTexture/SampledTexture1D/vk.sampledtexture1d.get-dimensions.hlsl
This file contains hidden or 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,75 @@ | ||
| // RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s | ||
| // RUN: not %dxc -T ps_6_0 -E main -fcgl %s -spirv -DERROR 2>&1 | FileCheck %s --check-prefix=ERROR | ||
|
|
||
| // CHECK: OpCapability ImageQuery | ||
|
|
||
| // CHECK: [[type_1d_image:%[a-zA-Z0-9_]+]] = OpTypeImage %float 1D 0 0 0 1 Unknown | ||
| // CHECK: [[type_1d_sampled_image:%[a-zA-Z0-9_]+]] = OpTypeSampledImage [[type_1d_image]] | ||
|
|
||
| vk::SampledTexture1D<float4> tex1d; | ||
|
|
||
| void main() { | ||
| uint mipLevel = 1; | ||
| uint width, height, numLevels, elements, numSamples; | ||
|
|
||
| // CHECK: [[t1_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d | ||
| // CHECK-NEXT: [[image1:%[0-9]+]] = OpImage [[type_1d_image]] [[t1_load]] | ||
| // CHECK-NEXT: [[query1:%[0-9]+]] = OpImageQuerySizeLod %uint [[image1]] %int_0 | ||
| // CHECK-NEXT: OpStore %width [[query1]] | ||
| tex1d.GetDimensions(width); | ||
|
|
||
| // CHECK: [[t2_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d | ||
| // CHECK-NEXT: [[image2:%[0-9]+]] = OpImage [[type_1d_image]] [[t2_load]] | ||
| // CHECK-NEXT: [[mip:%[0-9]+]] = OpLoad %uint %mipLevel | ||
| // CHECK-NEXT: [[query2:%[0-9]+]] = OpImageQuerySizeLod %uint [[image2]] [[mip]] | ||
| // CHECK-NEXT: OpStore %width [[query2]] | ||
| // CHECK-NEXT: [[query_level_2:%[0-9]+]] = OpImageQueryLevels %uint [[image2]] | ||
| // CHECK-NEXT: OpStore %numLevels [[query_level_2]] | ||
| tex1d.GetDimensions(mipLevel, width, numLevels); | ||
|
|
||
| float f_width, f_height, f_numLevels; | ||
| // CHECK: [[t3_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d | ||
| // CHECK-NEXT: [[image3:%[0-9]+]] = OpImage [[type_1d_image]] [[t3_load]] | ||
| // CHECK-NEXT: [[query3:%[0-9]+]] = OpImageQuerySizeLod %uint [[image3]] %int_0 | ||
| // CHECK-NEXT: [[f_query3:%[0-9]+]] = OpConvertUToF %float [[query3]] | ||
| // CHECK-NEXT: OpStore %f_width [[f_query3]] | ||
| tex1d.GetDimensions(f_width); | ||
|
|
||
| // CHECK: [[t4_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d | ||
| // CHECK-NEXT: [[image4:%[0-9]+]] = OpImage [[type_1d_image]] [[t4_load]] | ||
| // CHECK-NEXT: [[mip4:%[0-9]+]] = OpLoad %uint %mipLevel | ||
| // CHECK-NEXT: [[query4:%[0-9]+]] = OpImageQuerySizeLod %uint [[image4]] [[mip4]] | ||
| // CHECK-NEXT: [[f_query4:%[0-9]+]] = OpConvertUToF %float [[query4]] | ||
| // CHECK-NEXT: OpStore %f_width [[f_query4]] | ||
| // CHECK-NEXT: [[query_level_4:%[0-9]+]] = OpImageQueryLevels %uint [[image4]] | ||
| // CHECK-NEXT: [[f_query_level_4:%[0-9]+]] = OpConvertUToF %float [[query_level_4]] | ||
| // CHECK-NEXT: OpStore %f_numLevels [[f_query_level_4]] | ||
| tex1d.GetDimensions(mipLevel, f_width, f_numLevels); | ||
|
|
||
| int i_width, i_height, i_numLevels; | ||
| // CHECK: [[t5_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d | ||
| // CHECK-NEXT: [[image5:%[0-9]+]] = OpImage [[type_1d_image]] [[t5_load]] | ||
| // CHECK-NEXT: [[query5:%[0-9]+]] = OpImageQuerySizeLod %uint [[image5]] %int_0 | ||
| // CHECK-NEXT: [[query5_i:%[0-9]+]] = OpBitcast %int [[query5]] | ||
| // CHECK-NEXT: OpStore %i_width [[query5_i]] | ||
| tex1d.GetDimensions(i_width); | ||
|
|
||
| // CHECK: [[t6_load:%[0-9]+]] = OpLoad [[type_1d_sampled_image]] %tex1d | ||
| // CHECK-NEXT: [[image6:%[0-9]+]] = OpImage [[type_1d_image]] [[t6_load]] | ||
| // CHECK-NEXT: [[mip6:%[0-9]+]] = OpLoad %uint %mipLevel | ||
| // CHECK-NEXT: [[query6:%[0-9]+]] = OpImageQuerySizeLod %uint [[image6]] [[mip6]] | ||
| // CHECK-NEXT: [[query6_i:%[0-9]+]] = OpBitcast %int [[query6]] | ||
| // CHECK-NEXT: OpStore %i_width [[query6_i]] | ||
| // CHECK-NEXT: [[query_level_6:%[0-9]+]] = OpImageQueryLevels %uint [[image6]] | ||
| // CHECK-NEXT: [[query_level_6_i:%[0-9]+]] = OpBitcast %int [[query_level_6]] | ||
| // CHECK-NEXT: OpStore %i_numLevels [[query_level_6_i]] | ||
| tex1d.GetDimensions(mipLevel, i_width, i_numLevels); | ||
|
|
||
| #ifdef ERROR | ||
| // ERROR: error: no matching member function for call to 'GetDimensions' | ||
| tex1d.GetDimensions(mipLevel, 0, height, numLevels); | ||
|
|
||
| // ERROR: error: no matching member function for call to 'GetDimensions' | ||
| tex1d.GetDimensions(width, 20); | ||
| #endif | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.