mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
* Shader -> SPIR-V at CTS build time (#1849) Instead of relying on prebuilt checked-in SPIR-V files, compile available shaders at CTS build time. * Add dependency on glslc (available as part of VULKAN_SDK). * Add optional build flag BUILD_GLSL_SHADERS, OFF by default. * Remove pre-built SPIR-V files * Compile Shader -> SPIR-V at CTS build time * Use glslangValidator for shader -> spirv * Add glslangValidator tool for shader -> spirv * Refactor glslangValidator tool retrieval * Address review comments * Use add_subdirectory() instead of include() * Use glslang instead of glslangValidator * Update Github actions CI to install Vulkan SDK
31 lines
1.4 KiB
Plaintext
31 lines
1.4 KiB
Plaintext
#version 450
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
#extension GL_EXT_shader_explicit_arithmetic_types_int32 : enable
|
|
|
|
#define MAX_2D_IMAGES 5
|
|
#define MAX_2D_IMAGE_MIP_LEVELS 11
|
|
#define MAX_2D_IMAGE_DESCRIPTORS MAX_2D_IMAGES * MAX_2D_IMAGE_MIP_LEVELS
|
|
|
|
layout(binding = 0) buffer Params
|
|
{
|
|
uint32_t numImage2DDescriptors;
|
|
};
|
|
layout(binding = 1, GLSL_FORMAT ) uniform GLSL_TYPE_PREFIXimage2D image2DList[ MAX_2D_IMAGE_DESCRIPTORS ];
|
|
layout(local_size_x = 32, local_size_y = 32) in;
|
|
void main() {
|
|
uvec3 numThreads = gl_NumWorkGroups * gl_WorkGroupSize;
|
|
for (uint32_t image2DIdx = 0; image2DIdx < numImage2DDescriptors; image2DIdx++) {
|
|
ivec2 imageDim = imageSize(image2DList[image2DIdx]);
|
|
uint32_t heightBy2 = imageDim.y / 2;
|
|
for (uint32_t row = gl_GlobalInvocationID.y; row < heightBy2; row += numThreads.y) {
|
|
for (uint32_t col = gl_GlobalInvocationID.x; col < imageDim.x; col += numThreads.x) {
|
|
ivec2 coordsA = ivec2(col, row);
|
|
ivec2 coordsB = ivec2(col, imageDim.y - row - 1);
|
|
GLSL_TYPE_PREFIXvec4 dataA = imageLoad(image2DList[image2DIdx], coordsA);
|
|
GLSL_TYPE_PREFIXvec4 dataB = imageLoad(image2DList[image2DIdx], coordsB);
|
|
imageStore(image2DList[image2DIdx], coordsA, dataB);
|
|
imageStore(image2DList[image2DIdx], coordsB, dataA);
|
|
}
|
|
}
|
|
}
|
|
} |