diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index e8fd8c45..0da329e1 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -50,6 +50,11 @@ jobs: cd OpenCL-Headers ln -s CL OpenCL # For OSX builds cd .. + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@main + with: + version: 1.3.275.0 + cache: true - name: Build shell: bash run: ./presubmit.sh diff --git a/test_conformance/vulkan/CMakeLists.txt b/test_conformance/vulkan/CMakeLists.txt index 9778693b..9c9cc7d4 100644 --- a/test_conformance/vulkan/CMakeLists.txt +++ b/test_conformance/vulkan/CMakeLists.txt @@ -43,4 +43,6 @@ set_source_files_properties( PROPERTIES LANGUAGE CXX) include_directories("../common/vulkan_wrapper") +add_subdirectory(shaders) + include(../CMakeCommon.txt) diff --git a/test_conformance/vulkan/shaders/CMakeLists.txt b/test_conformance/vulkan/shaders/CMakeLists.txt new file mode 100644 index 00000000..881b3f20 --- /dev/null +++ b/test_conformance/vulkan/shaders/CMakeLists.txt @@ -0,0 +1,45 @@ +# CMP0007:NEW - Don't ignore empty elements in a list +cmake_policy(SET CMP0007 NEW) +find_program( + Vulkan_glslang_binary + NAMES glslang + HINTS $ENV{VULKAN_SDK}) + +if(${Vulkan_glslang_binary} STREQUAL "Vulkan_glslang_binary-NOTFOUND") + message(FATAL_ERROR "glslang tool (part of Vulkan SDK) is a prerequisite to compile shaders to spir-v") +else() + message(STATUS "Found glslang: ${Vulkan_glslang_binary}") + + set(IMAGE2D_SHADER_IN_FILE "image2D.comp") + set(IMAGE2D_SHADER_TMP_OUT_FILE "tmp_image2D.comp") + set(BUFFER_SHADER_IN_FILE "buffer") + set(IMAGE2D_FORMATS_LIST_IN_FILE "image2D_test_formats.txt") + + file(READ ${IMAGE2D_SHADER_IN_FILE} IMAGE2D_SHADER_UNFORMAT_CONTENT) + file(STRINGS ${IMAGE2D_FORMATS_LIST_IN_FILE} IMAGE2D_FORMATS_LIST) + + foreach(IMAGE2D_FORMAT ${IMAGE2D_FORMATS_LIST}) + list(GET IMAGE2D_FORMAT 1 GLSL_FORMAT) + list(GET IMAGE2D_FORMAT 2 GLSL_TYPE_PREFIX) + string(REPLACE "GLSL_FORMAT" "${GLSL_FORMAT}" IMAGE2D_SHADER_CONTENT "${IMAGE2D_SHADER_UNFORMAT_CONTENT}") + string(REPLACE "GLSL_TYPE_PREFIX" "${GLSL_TYPE_PREFIX}" IMAGE2D_SHADER_CONTENT "${IMAGE2D_SHADER_CONTENT}") + file(WRITE ${IMAGE2D_SHADER_TMP_OUT_FILE} "${IMAGE2D_SHADER_CONTENT}") + execute_process( + COMMAND ${Vulkan_glslang_binary} --target-env vulkan1.0 -o image2D_${GLSL_FORMAT}.spv ${IMAGE2D_SHADER_TMP_OUT_FILE} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE commandStatus + OUTPUT_QUIET) + if(commandStatus AND NOT commandStatus EQUAL 0) + message(FATAL_ERROR "shader -> spir-v compilation failed") + endif() + endforeach(IMAGE2D_FORMAT) + execute_process( + COMMAND ${Vulkan_glslang_binary} --target-env vulkan1.0 -o ${BUFFER_SHADER_IN_FILE}.spv ${BUFFER_SHADER_IN_FILE}.comp + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE commandStatus + OUTPUT_QUIET) + if(commandStatus AND NOT commandStatus EQUAL 0) + message(FATAL_ERROR "shader -> spir-v compilation failed") + endif() + file(REMOVE ${IMAGE2D_SHADER_TMP_OUT_FILE}) +endif() \ No newline at end of file diff --git a/test_conformance/vulkan/shaders/buffer.spv b/test_conformance/vulkan/shaders/buffer.spv deleted file mode 100644 index c9d15950..00000000 Binary files a/test_conformance/vulkan/shaders/buffer.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D.comp b/test_conformance/vulkan/shaders/image2D.comp index 42fa2f73..6c0f6f26 100644 --- a/test_conformance/vulkan/shaders/image2D.comp +++ b/test_conformance/vulkan/shaders/image2D.comp @@ -10,7 +10,7 @@ layout(binding = 0) buffer Params { uint32_t numImage2DDescriptors; }; -layout(binding = 1, rgba32f ) uniform image2D image2DList[ MAX_2D_IMAGE_DESCRIPTORS ]; +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; @@ -21,8 +21,8 @@ void main() { 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); - vec4 dataA = imageLoad(image2DList[image2DIdx], coordsA); - vec4 dataB = imageLoad(image2DList[image2DIdx], coordsB); + 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); } diff --git a/test_conformance/vulkan/shaders/image2D_r16i.spv b/test_conformance/vulkan/shaders/image2D_r16i.spv deleted file mode 100644 index 00c5c283..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r16i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_r16ui.spv b/test_conformance/vulkan/shaders/image2D_r16ui.spv deleted file mode 100644 index 87514d9f..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r16ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_r32f.spv b/test_conformance/vulkan/shaders/image2D_r32f.spv deleted file mode 100644 index e82c9c19..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r32f.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_r32i.spv b/test_conformance/vulkan/shaders/image2D_r32i.spv deleted file mode 100644 index 7ea8d26f..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r32i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_r32ui.spv b/test_conformance/vulkan/shaders/image2D_r32ui.spv deleted file mode 100644 index dbcdbc5f..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r32ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_r8i.spv b/test_conformance/vulkan/shaders/image2D_r8i.spv deleted file mode 100644 index 1a641475..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r8i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_r8ui.spv b/test_conformance/vulkan/shaders/image2D_r8ui.spv deleted file mode 100644 index a90ccf98..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_r8ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg16i.spv b/test_conformance/vulkan/shaders/image2D_rg16i.spv deleted file mode 100644 index 07996173..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg16i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg16ui.spv b/test_conformance/vulkan/shaders/image2D_rg16ui.spv deleted file mode 100644 index f73e096b..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg16ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg32f.spv b/test_conformance/vulkan/shaders/image2D_rg32f.spv deleted file mode 100644 index 1489660e..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg32f.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg32i.spv b/test_conformance/vulkan/shaders/image2D_rg32i.spv deleted file mode 100644 index b7d302f4..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg32i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg32ui.spv b/test_conformance/vulkan/shaders/image2D_rg32ui.spv deleted file mode 100644 index 6cf2f1b8..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg32ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg8i.spv b/test_conformance/vulkan/shaders/image2D_rg8i.spv deleted file mode 100644 index a71b9bf0..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg8i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rg8ui.spv b/test_conformance/vulkan/shaders/image2D_rg8ui.spv deleted file mode 100644 index 2aca9290..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rg8ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba16i.spv b/test_conformance/vulkan/shaders/image2D_rgba16i.spv deleted file mode 100644 index 0cb95dfd..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba16i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba16ui.spv b/test_conformance/vulkan/shaders/image2D_rgba16ui.spv deleted file mode 100644 index 84c3d3db..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba16ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba32f.spv b/test_conformance/vulkan/shaders/image2D_rgba32f.spv deleted file mode 100644 index 35136c58..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba32f.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba32i.spv b/test_conformance/vulkan/shaders/image2D_rgba32i.spv deleted file mode 100644 index 4d1ae581..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba32i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba32ui.spv b/test_conformance/vulkan/shaders/image2D_rgba32ui.spv deleted file mode 100644 index bed86f0c..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba32ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba8i.spv b/test_conformance/vulkan/shaders/image2D_rgba8i.spv deleted file mode 100644 index edf8c58c..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba8i.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_rgba8ui.spv b/test_conformance/vulkan/shaders/image2D_rgba8ui.spv deleted file mode 100644 index bb9a770c..00000000 Binary files a/test_conformance/vulkan/shaders/image2D_rgba8ui.spv and /dev/null differ diff --git a/test_conformance/vulkan/shaders/image2D_test_formats.txt b/test_conformance/vulkan/shaders/image2D_test_formats.txt new file mode 100644 index 00000000..03c4d49f --- /dev/null +++ b/test_conformance/vulkan/shaders/image2D_test_formats.txt @@ -0,0 +1,21 @@ +VULKAN_FORMAT_R8_UINT;r8ui;u +VULKAN_FORMAT_R8_SINT;r8i;i +VULKAN_FORMAT_R8G8_UINT;rg8ui;u +VULKAN_FORMAT_R8G8_SINT;rg8i;i +VULKAN_FORMAT_R8G8B8A8_UINT;rgba8ui;u +VULKAN_FORMAT_R8G8B8A8_SINT;rgba8i;i +VULKAN_FORMAT_R16_UINT;r16ui;u +VULKAN_FORMAT_R16_SINT;r16i;i +VULKAN_FORMAT_R16G16_UINT;rg16ui;u +VULKAN_FORMAT_R16G16_SINT;rg16i;i +VULKAN_FORMAT_R16G16B16A16_UINT;rgba16ui;u +VULKAN_FORMAT_R16G16B16A16_SINT;rgba16i;i +VULKAN_FORMAT_R32_UINT;r32ui;u +VULKAN_FORMAT_R32_SINT;r32i;i +VULKAN_FORMAT_R32_SFLOAT;r32f; +VULKAN_FORMAT_R32G32_UINT;rg32ui;u +VULKAN_FORMAT_R32G32_SINT;rg32i;i +VULKAN_FORMAT_R32G32_SFLOAT;rg32f; +VULKAN_FORMAT_R32G32B32A32_UINT;rgba32ui;u +VULKAN_FORMAT_R32G32B32A32_SINT;rgba32i;i +VULKAN_FORMAT_R32G32B32A32_SFLOAT;rgba32f;