-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1366 from KhronosGroup/fix-1365
HLSL: Implement image queries for UAV images.
- Loading branch information
Showing
8 changed files
with
355 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
void frag_main() | ||
{ | ||
} | ||
|
||
void main() | ||
{ | ||
frag_main(); | ||
} |
8 changes: 8 additions & 0 deletions
8
reference/opt/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag
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,8 @@ | ||
void frag_main() | ||
{ | ||
} | ||
|
||
void main() | ||
{ | ||
frag_main(); | ||
} |
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,64 @@ | ||
RWTexture1D<float4> uImage1D : register(u0); | ||
RWTexture2D<float2> uImage2D : register(u1); | ||
RWTexture2DArray<float> uImage2DArray : register(u2); | ||
RWTexture3D<unorm float4> uImage3D : register(u3); | ||
RWBuffer<snorm float4> uImageBuffer : register(u6); | ||
|
||
uint3 SPIRV_Cross_imageSize(RWTexture2DArray<float> Tex, out uint Param) | ||
{ | ||
uint3 ret; | ||
Tex.GetDimensions(ret.x, ret.y, ret.z); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint2 SPIRV_Cross_imageSize(RWTexture2D<float2> Tex, out uint Param) | ||
{ | ||
uint2 ret; | ||
Tex.GetDimensions(ret.x, ret.y); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint SPIRV_Cross_imageSize(RWTexture1D<float4> Tex, out uint Param) | ||
{ | ||
uint ret; | ||
Tex.GetDimensions(ret.x); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint3 SPIRV_Cross_imageSize(RWTexture3D<unorm float4> Tex, out uint Param) | ||
{ | ||
uint3 ret; | ||
Tex.GetDimensions(ret.x, ret.y, ret.z); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint SPIRV_Cross_imageSize(RWBuffer<snorm float4> Tex, out uint Param) | ||
{ | ||
uint ret; | ||
Tex.GetDimensions(ret.x); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
void frag_main() | ||
{ | ||
uint _14_dummy_parameter; | ||
int a = int(SPIRV_Cross_imageSize(uImage1D, _14_dummy_parameter)); | ||
uint _22_dummy_parameter; | ||
int2 b = int2(SPIRV_Cross_imageSize(uImage2D, _22_dummy_parameter)); | ||
uint _30_dummy_parameter; | ||
int3 c = int3(SPIRV_Cross_imageSize(uImage2DArray, _30_dummy_parameter)); | ||
uint _36_dummy_parameter; | ||
int3 d = int3(SPIRV_Cross_imageSize(uImage3D, _36_dummy_parameter)); | ||
uint _42_dummy_parameter; | ||
int e = int(SPIRV_Cross_imageSize(uImageBuffer, _42_dummy_parameter)); | ||
} | ||
|
||
void main() | ||
{ | ||
frag_main(); | ||
} |
63 changes: 63 additions & 0 deletions
63
reference/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag
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,63 @@ | ||
RWTexture1D<float4> uImage1D : register(u0); | ||
RWTexture2D<float2> uImage2D : register(u1); | ||
Texture2DArray<float4> uImage2DArray : register(t2); | ||
RWTexture3D<unorm float4> uImage3D : register(u3); | ||
RWBuffer<snorm float4> uImageBuffer : register(u6); | ||
|
||
uint3 SPIRV_Cross_textureSize(Texture2DArray<float4> Tex, uint Level, out uint Param) | ||
{ | ||
uint3 ret; | ||
Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); | ||
return ret; | ||
} | ||
|
||
uint2 SPIRV_Cross_imageSize(RWTexture2D<float2> Tex, out uint Param) | ||
{ | ||
uint2 ret; | ||
Tex.GetDimensions(ret.x, ret.y); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint SPIRV_Cross_imageSize(RWTexture1D<float4> Tex, out uint Param) | ||
{ | ||
uint ret; | ||
Tex.GetDimensions(ret.x); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint3 SPIRV_Cross_imageSize(RWTexture3D<unorm float4> Tex, out uint Param) | ||
{ | ||
uint3 ret; | ||
Tex.GetDimensions(ret.x, ret.y, ret.z); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
uint SPIRV_Cross_imageSize(RWBuffer<snorm float4> Tex, out uint Param) | ||
{ | ||
uint ret; | ||
Tex.GetDimensions(ret.x); | ||
Param = 0u; | ||
return ret; | ||
} | ||
|
||
void frag_main() | ||
{ | ||
uint _14_dummy_parameter; | ||
int a = int(SPIRV_Cross_imageSize(uImage1D, _14_dummy_parameter)); | ||
uint _22_dummy_parameter; | ||
int2 b = int2(SPIRV_Cross_imageSize(uImage2D, _22_dummy_parameter)); | ||
uint _30_dummy_parameter; | ||
int3 c = int3(SPIRV_Cross_textureSize(uImage2DArray, 0u, _30_dummy_parameter)); | ||
uint _36_dummy_parameter; | ||
int3 d = int3(SPIRV_Cross_imageSize(uImage3D, _36_dummy_parameter)); | ||
uint _42_dummy_parameter; | ||
int e = int(SPIRV_Cross_imageSize(uImageBuffer, _42_dummy_parameter)); | ||
} | ||
|
||
void main() | ||
{ | ||
frag_main(); | ||
} |
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,18 @@ | ||
#version 450 | ||
|
||
layout(rgba32f, binding = 0) uniform writeonly image1D uImage1D; | ||
layout(rg32f, binding = 1) uniform writeonly image2D uImage2D; | ||
layout(r32f, binding = 2) uniform readonly image2DArray uImage2DArray; | ||
layout(rgba8, binding = 3) uniform writeonly image3D uImage3D; | ||
layout(rgba8_snorm, binding = 6) uniform writeonly imageBuffer uImageBuffer; | ||
|
||
// There is no RWTexture2DMS. | ||
|
||
void main() | ||
{ | ||
int a = imageSize(uImage1D); | ||
ivec2 b = imageSize(uImage2D); | ||
ivec3 c = imageSize(uImage2DArray); | ||
ivec3 d = imageSize(uImage3D); | ||
int e = imageSize(uImageBuffer); | ||
} |
18 changes: 18 additions & 0 deletions
18
shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag
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,18 @@ | ||
#version 450 | ||
|
||
layout(rgba32f, binding = 0) uniform writeonly image1D uImage1D; | ||
layout(rg32f, binding = 1) uniform writeonly image2D uImage2D; | ||
layout(r32f, binding = 2) uniform readonly image2DArray uImage2DArray; | ||
layout(rgba8, binding = 3) uniform writeonly image3D uImage3D; | ||
layout(rgba8_snorm, binding = 6) uniform writeonly imageBuffer uImageBuffer; | ||
|
||
// There is no RWTexture2DMS. | ||
|
||
void main() | ||
{ | ||
int a = imageSize(uImage1D); | ||
ivec2 b = imageSize(uImage2D); | ||
ivec3 c = imageSize(uImage2DArray); | ||
ivec3 d = imageSize(uImage3D); | ||
int e = imageSize(uImageBuffer); | ||
} |
Oops, something went wrong.